:root {
  --bg-main: #050910;
  --bg-panel: #060d18;
  --bg-terminal: #050b14;
  --border-soft: #182332;
  --accent: #3af5ac;
  --accent-amber: #f4c98a;
  --text-main: #cde6ff;
  --text-muted: #6b809a;
  --danger: #ff5c7a;
  --font-mono: 'JetBrains Mono', monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

body {
  background: radial-gradient(circle at top, #0a1220 0, #040816 60%, #000 100%);
  color: var(--text-main);
  font-family: var(--font-mono);
  overflow: hidden;
}

/* DESKTOP GRID */
.dashboard {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 240px;
  grid-template-rows: 100%;
  grid-template-areas: "left center right";
  height: 100vh;
  width: 100vw;
}

.panel {
  background: rgba(6, 13, 24, 0.96);
  border: 1px solid var(--border-soft);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow-y: auto;
}

.panel-left {
  grid-area: left;
}

.panel-right {
  grid-area: right;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
  gap: 12px;
  flex-shrink: 0;
}

#langButtons {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.langBtn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  padding: 2px 5px;
  font-size: 10px;
  cursor: pointer;
  font-family: var(--font-mono);
}

.langBtn.active {
  color: var(--accent);
  border-color: var(--accent);
}

.time-block {
  border: 1px solid var(--border-soft);
  padding: 8px;
  margin-bottom: 0;
}

.time {
  font-size: 24px;
  letter-spacing: 0.12em;
}

.date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stats-block,
.session-block,
.info-block {
  border: 1px solid var(--border-soft);
  padding: 8px;
}

.stats-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stats-grid {
  font-size: 11px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 1px 0;
}

.session-lines {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-main);
}

.weather-text {
  font-size: 11px;
  line-height: 1.5;
  color: var(--accent-amber);
}

#currentReadersContainer,
#quoteContainer,
#vocabContainer,
#moodContainer {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-main);
}

#currentReadersContainer {
  color: var(--accent-amber);
}

#quoteContainer,
#vocabContainer {
  color: var(--accent-amber);
}

#moodContainer {
  color: var(--text-main);
}

/* CENTER AREA: 50% top / 50% bottom */
.terminal-area {
  grid-area: center;
  display: grid;
  grid-template-rows: 50% 50%;
  border: 1px solid var(--border-soft);
  background: var(--bg-terminal);
  overflow: hidden;
}

/* TOP ROW: 3 EQUAL COLUMNS */
.top-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
  min-height: 0;
}

.feed-block {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  overflow: hidden;
  min-height: 0;
}

.feed-block .terminal-header {
  flex-shrink: 0;
}

.feed-output {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  overflow-y: auto;
  min-height: 0;
}

.feed-user {
  margin-bottom: 8px;
}

.feed-user-name {
  font-size: 11px;
  color: var(--accent);
  text-transform: none;
  margin-bottom: 2px;
}

.feed-book {
  margin-left: 6px;
  margin-bottom: 4px;
  font-size: 11px;
}

.feed-book-title {
  color: var(--accent-amber);
}

.feed-event {
  margin-left: 10px;
  font-size: 11px;
  color: var(--text-main);
}

/* ACTIVITY BLOCK: spans 2 columns, splits into 2 equal parts */
.activity-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-column: span 2;
  overflow: hidden;
  min-height: 0;
}

.activity-section {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  overflow: hidden;
  min-height: 0;
}

.activity-section:last-child {
  border-right: none;
}

.activity-section .stats-title {
  padding: 6px 10px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.activity-section .recent-text {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  min-height: 0;
}

.recent-text {
  font-size: 11px;
  line-height: 1.5;
}

.activity-day-header {
  color: var(--accent);
  font-weight: 600;
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.activity-day-header:first-child {
  margin-top: 0;
}

.activity-item {
  font-size: 10px;
  color: var(--text-main);
  margin-bottom: 3px;
  line-height: 1.4;
}

.activity-time {
  color: var(--text-muted);
  margin-right: 4px;
}

/* STREAK SECTION */
.streak-section {
  display: flex;
  flex-direction: column;
}

.streak-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.streak-header .stats-title {
  padding: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.streak-user-select {
  background: var(--bg-terminal);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  cursor: pointer;
  outline: none;
}

.streak-user-select:focus {
  border-color: var(--accent);
}

.streak-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  overflow-y: auto;
  min-height: 0;
}

.streak-graph {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  height: 60px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}

.streak-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.streak-bar {
  width: 100%;
  max-width: 24px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}

.streak-bar.empty {
  background: var(--border-soft);
}

.streak-bar-label {
  font-size: 8px;
  color: var(--text-muted);
  margin-top: 2px;
  text-align: center;
}

.streak-bar-pages {
  font-size: 8px;
  color: var(--accent-amber);
  margin-bottom: 2px;
}

.streak-stats {
  font-size: 11px;
  line-height: 1.5;
}

/* SHELL: BOTTOM 50% */
.shell-block {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.terminal-output {
  flex: 1;
  padding: 10px;
  font-size: 12px;
  line-height: 1.4;
  overflow-y: auto;
  white-space: pre-wrap;
  min-height: 0;
}

.terminal-output .line {
  margin-bottom: 2px;
}

.terminal-output .line.error {
  color: var(--danger);
}

.terminal-output .line.success {
  color: var(--accent);
}

.terminal-input-bar {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border-soft);
  padding: 6px 10px;
  font-size: 12px;
  position: relative;
  flex-shrink: 0;
}

.prompt-label {
  margin-right: 6px;
  color: var(--accent-amber);
}

#terminalInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  caret-color: var(--accent);
}

/* RIGHT PANEL: BOOKSHELF */
.book-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
}

.book-tile {
  border: 1px solid var(--border-soft);
  padding: 6px 8px;
  font-size: 11px;
  cursor: pointer;
  background: #07101d;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.book-tile span.title {
  font-weight: 600;
}

.book-tile span.meta {
  color: var(--text-muted);
}

.book-tile span.progress {
  color: var(--accent-amber);
}

.book-tile:hover {
  background: #0e1b2b;
  border-color: var(--accent);
}

.book-tile.finished {
  border-color: var(--accent);
}

.book-tile.finished span.title::before {
  content: "✔ ";
  color: var(--accent);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #02050a;
}

::-webkit-scrollbar-thumb {
  background: #182332;
}

::-webkit-scrollbar-thumb:hover {
  background: #24354b;
}

.accent {
  color: var(--accent);
}

.accent-amber {
  color: var(--accent-amber);
}

/* INPUT MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  padding: 16px 20px;
  min-width: 280px;
  max-width: 90%;
}

.modal-title {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.modal-buttons button {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-buttons button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#modalOk {
  border-color: var(--accent);
  color: var(--accent);
}
#modalInputText,
#modalInputPassword {
  width: 100%;
  background: var(--bg-terminal);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  caret-color: var(--accent);
}

#modalInputText:focus,
#modalInputPassword:focus {
  border-color: var(--accent);
}
/* BOOK SELECTOR MODAL */
.book-selector-box {
  min-width: 320px;
  max-width: 400px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.book-selector-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.book-selector-item {
  border: 1px solid var(--border-soft);
  padding: 10px 12px;
  cursor: pointer;
  background: var(--bg-terminal);
  transition: all 0.15s ease;
}

.book-selector-item:hover {
  background: #0e1b2b;
  border-color: var(--accent);
}

.book-selector-item .book-title {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.book-selector-item .book-author {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.book-selector-item .book-progress {
  font-size: 11px;
  color: var(--accent-amber);
}

.book-selector-empty {
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px;
  text-align: center;
}

/* ===================== MOBILE ===================== */
@media (max-width: 900px) {
  html, body {
    overflow: auto;
    height: auto;
  }

  body {
    overflow-x: hidden;
  }

  .dashboard {
    display: block;
    height: auto;
    min-height: 100vh;
    width: 100%;
  }

  .panel-left {
    width: 100%;
    height: auto;
    overflow: visible;
    border: 1px solid var(--border-soft);
    border-bottom: none;
  }

  .terminal-area {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border-soft);
    border-bottom: none;
  }

  .top-row {
    display: block;
    height: auto;
    border-bottom: 1px solid var(--border-soft);
  }

  .feed-block {
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    min-height: 150px;
    height: auto;
  }

  .feed-output {
    max-height: 180px;
    overflow-y: auto;
  }

  .activity-block {
    display: flex;
    flex-direction: row;
    height: auto;
    min-height: 100px;
  }

  .activity-section {
    flex: 1;
    min-height: 100px;
    border-right: 1px solid var(--border-soft);
  }

  .activity-section:last-child {
    border-right: none;
  }

  .activity-section .recent-text {
    max-height: 120px;
    overflow-y: auto;
  }

  .shell-block {
    min-height: 200px;
    height: auto;
  }

  .terminal-output {
    min-height: 100px;
    max-height: 180px;
    overflow-y: auto;
  }

  .panel-right {
    width: 100%;
    height: auto;
    min-height: 140px;
    border: 1px solid var(--border-soft);
  }

  .book-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding: 8px 0;
    min-height: 80px;
  }

  .book-tile {
    min-width: 150px;
    flex-shrink: 0;
  }

  .book-selector-box {
    min-width: 90%;
    max-width: 95%;
  }
  .book-tile span.rating {
  color: var(--accent-amber);
  font-size: 10px;
}

}






