* {
  box-sizing: border-box;
  user-select: none;
}

/* Solarized Dark Theme */
:root {
  --desktop-bg: #001b21;
  --window-border: #073642;
  --bg-color: #002b36;
  --text-color: #839496;
  --prompt-color: #268bd2;
  --cursor-color: #859900;
  --error-color: #dc322f;
}

body {
  background-color: var(--desktop-bg);
  background-image: radial-gradient(circle at 50% 50%, #073642 0%, #001b21 100%);
  color: var(--text-color);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 15px;
  margin: 0;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* --- Desktop Icon Styling --- */
#desktop {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.file-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding: 10px;
  border-radius: 5px;
  transition: background 0.2s;
}

.file-icon:hover {
  background: rgba(255, 255, 255, 0.1);
}

.file-icon svg {
  width: 50px;
  height: 50px;
  fill: var(--text-color);
  margin-bottom: 5px;
}

.file-name {
  color: #eee8d5;
  text-align: center;
  font-size: 13px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* --- Window Styling --- */
#window-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 850px;
  height: 75vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #1a4a57;
  z-index: 10;
}

#title-bar {
  background-color: var(--window-border);
  height: 35px;
  display: flex;
  align-items: center;
  padding: 0 15px;
  position: relative;
}

.window-controls {
  display: flex;
  gap: 8px;
}

.control-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  cursor: pointer;
}

.close-btn { background-color: var(--error-color); }
.close-btn:hover { background-color: #ff4c4c; }

.min-btn { background-color: #b58900; }
.max-btn { background-color: #859900; }

.window-title {
  position: absolute;
  width: 100%;
  text-align: center;
  left: 0;
  pointer-events: none;
  color: #93a1a1;
  font-size: 14px;
  font-weight: bold;
}

/* --- Terminal Styling --- */
#terminal {
  flex-grow: 1;
  overflow-y: auto;
  padding: 15px 20px;
  background-color: var(--bg-color);
  cursor: text;
}

#terminal::-webkit-scrollbar { width: 8px; }
#terminal::-webkit-scrollbar-thumb {
  background: #073642;
  border-radius: 4px;
}

.line {
  margin-bottom: 6px;
  white-space: pre-wrap;
  line-height: 1.5;
  word-break: break-word;
  user-select: text;
}

.prompt-line {
  display: flex;
  align-items: flex-start;
  margin-top: 5px;
}

.prompt-prefix {
  color: var(--prompt-color);
  margin-right: 10px;
  font-weight: bold;
}

.input-container {
  position: relative;
  flex-grow: 1;
  display: flex;
  align-items: center;
}

#hidden-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: text;
  border: none;
  outline: none;
  z-index: -1;
}

#visual-input {
  white-space: pre-wrap;
  word-break: break-all;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 18px;
  background-color: var(--cursor-color);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.typing-in-progress .prompt-line {
  display: none;
}

@media (max-width: 768px) {
  #desktop {
    top: 16px;
    left: 16px;
    z-index: 20;
  }

  #window-container {
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    border: none;
    display: none;
  }

  body.terminal-open #desktop {
    display: none;
  }

  body.terminal-open #window-container {
    display: flex;
  }
}

