:root {
  --bg-primary: #000000;
  --bg-secondary: #0f1219;
  --bg-tertiary: #161c26;
  --bg-card: #1d2635;
  --bg-card-strong: #243145;
  --text-primary: #ffffff;
  --text-secondary: #bcc7d8;
  --text-muted: #708096;
  --accent-primary: #74f2ce;
  --accent-secondary: #6ec3ff;
  --accent-warm: #ffc46b;
  --danger: #ff6d8d;
  --focus-ring: #6ec3ff;
  --focus-glow: rgba(110, 195, 255, 0.34);
  --success: #74f2ce;
  --warning: #ffc46b;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --reader-font-size: 16px;
  --reader-line-height: 1.55;
  --reader-gap: 12px;
  --reader-color: #edf3ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: #000000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  mix-blend-mode: plus-lighter;
}

.app-root {
  width: 600px;
  height: 600px;
  padding: 4px;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.screen.hidden {
  display: none;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 16px 18px;
  border-radius: 24px 24px 16px 16px;
  background:
    linear-gradient(135deg, rgba(29, 38, 53, 0.98), rgba(15, 18, 25, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.header h1 {
  font-size: 25px;
  line-height: 1.05;
  font-weight: 700;
}

.header-meta {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.release-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.12);
  color: var(--accent-warm);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.header-stack {
  flex: 1;
  min-width: 0;
}

.status-pill {
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(116, 242, 206, 0.12);
  color: var(--accent-primary);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 2px 10px;
  overflow-y: auto;
  scrollbar-width: none;
}

.content::-webkit-scrollbar {
  display: none;
}

.hero-card,
.panel,
.reader-panel {
  background:
    linear-gradient(180deg, rgba(36, 49, 69, 0.95), rgba(22, 28, 38, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.hero-card {
  background:
    radial-gradient(circle at top left, rgba(116, 242, 206, 0.2), transparent 36%),
    radial-gradient(circle at top right, rgba(110, 195, 255, 0.24), transparent 28%),
    linear-gradient(180deg, rgba(36, 49, 69, 0.98), rgba(22, 28, 38, 0.98));
}

.hero-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.hero-action {
  min-height: 72px;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  text-align: left;
}

.hero-action.primary {
  background: linear-gradient(135deg, rgba(116, 242, 206, 0.9), rgba(110, 195, 255, 0.74));
  color: #0c1f1d;
}

.hero-action:focus {
  background: rgba(110, 195, 255, 0.16);
}

.hero-action.primary:focus {
  background: linear-gradient(135deg, #8bf4d7, #9fd7ff);
}

.hero-action-title,
.hero-action-meta {
  display: block;
}

.hero-action-title {
  font-size: 14px;
  font-weight: 850;
}

.hero-action-meta {
  margin-top: 5px;
  color: inherit;
  font-size: 11px;
  opacity: 0.78;
}

.hero-kicker {
  color: var(--accent-warm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
}

.hero-title {
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.12;
}

.hero-copy,
.summary-copy,
.summary-meta {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.42;
}

.compact {
  padding-bottom: 10px;
}

.field-label,
.section-heading h2 {
  font-size: 17px;
  font-weight: 700;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.section-action {
  min-height: 34px;
  padding: 6px 10px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 750;
}

.section-action:focus {
  background: rgba(110, 195, 255, 0.16);
  color: var(--text-primary);
}

.section-action.is-disabled {
  opacity: 0.42;
}

.helper-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 13px;
}

.chip:focus {
  background: rgba(110, 195, 255, 0.16);
  color: var(--text-primary);
}

.query-preview {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 48px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(116, 242, 206, 0.18), rgba(110, 195, 255, 0.12)),
    rgba(5, 8, 12, 0.94);
  border: 1px solid rgba(116, 242, 206, 0.22);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-preview.is-empty {
  color: var(--text-muted);
  font-weight: 700;
}

.key-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.jump-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.key {
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
}

.key.wide {
  grid-column: span 2;
}

.key:focus {
  background: rgba(110, 195, 255, 0.16);
}

.key-primary {
  background: linear-gradient(135deg, rgba(116, 242, 206, 0.9), rgba(110, 195, 255, 0.78));
  color: #0c1f1d;
}

.key-primary:not(.is-ready) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.key-primary:focus {
  background: linear-gradient(135deg, #8bf4d7, #9fd7ff);
  color: #081c1a;
}

.sr-only-input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.text-input {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: rgba(0, 0, 0, 0.14);
  color: transparent;
  font-size: 1px;
  caret-color: transparent;
  pointer-events: none;
}

.text-input::placeholder {
  color: var(--text-secondary);
  font-size: 13px;
}

.focusable {
  transition:
    transform 475ms cubic-bezier(0.6, 0, 0.4, 1),
    background-color 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
    box-shadow 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
    border-color 300ms cubic-bezier(0.4, 0.04, 0.5, 1);
  cursor: pointer;
}

.focusable:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
  transform: scale(0.96);
}

.back-btn,
.nav-item,
.list-item {
  border: 2px solid transparent;
}

.back-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 22px;
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-container.tall {
  max-height: 308px;
  overflow-y: auto;
  padding-right: 4px;
  position: relative;
}

.list-container.tall::after {
  content: "";
  position: sticky;
  bottom: 0;
  display: block;
  width: 100%;
  height: 44px;
  background: linear-gradient(180deg, rgba(29, 38, 53, 0), rgba(29, 38, 53, 0.95));
  pointer-events: none;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 13px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  text-align: left;
}

.list-item:focus {
  background: rgba(110, 195, 255, 0.16);
}

.list-item-icon {
  width: 38px;
  flex-shrink: 0;
  text-align: center;
  color: var(--accent-warm);
  font-size: 22px;
}

.list-item-content {
  min-width: 0;
  flex: 1;
}

.list-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
}

.list-item-meta {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
}

.list-item-badge {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.favorite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
}

.favorite-row .favorite-open {
  min-width: 0;
}

.mini-action {
  min-height: 72px;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: rgba(116, 242, 206, 0.1);
  color: var(--text-primary);
  text-align: center;
}

.mini-action:focus {
  background: rgba(110, 195, 255, 0.16);
}

.mini-action-title,
.mini-action-meta {
  display: block;
}

.mini-action-title {
  font-size: 14px;
  font-weight: 800;
}

.mini-action-meta {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setting-row h2 {
  font-size: 18px;
}

.setting-row p {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.setting-controls {
  display: grid;
  grid-template-columns: repeat(2, 56px);
  gap: 8px;
}

.summary-topline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.badge-info {
  background: rgba(110, 195, 255, 0.16);
  color: var(--accent-secondary);
}

.nav-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 0 0;
}

.nav-item {
  min-height: 68px;
  padding: 11px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
}

.nav-item.primary {
  background: linear-gradient(135deg, var(--accent-primary), #9af5df);
  color: #10221f;
}

.nav-item:focus {
  background: rgba(110, 195, 255, 0.16);
}

.nav-item.primary:focus {
  background: linear-gradient(135deg, #8bf4d7, #b5ffeb);
}

.loading-container,
.error-container {
  min-height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text,
.error-message {
  color: var(--text-secondary);
  font-size: 13px;
}

.error-icon {
  font-size: 32px;
  color: var(--danger);
}

.reader-panel {
  min-height: max-content;
}

.toast {
  position: fixed;
  left: 50%;
  top: 28px;
  transform: translateX(-50%) translateY(-12px);
  opacity: 0;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 18, 25, 0.96);
  border: 1px solid rgba(110, 195, 255, 0.36);
  color: var(--text-primary);
  font-size: 12px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: rgba(255, 109, 141, 0.48);
}

.toast.success {
  border-color: rgba(116, 242, 206, 0.48);
}

.reading-content {
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top left, rgba(116, 242, 206, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(36, 49, 69, 0.95), rgba(15, 18, 25, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.reading-content .reader-panel {
  min-height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
}

.reader-body {
  display: flex;
  flex-direction: column;
  gap: var(--reader-gap);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
}

.reader-body p {
  color: var(--reader-color);
}

#reader.focus-mode .header {
  min-height: 48px;
  padding: 8px 12px;
  opacity: 0.9;
}

#reader.focus-mode .back-btn,
#reader.focus-mode .header-meta,
#reader.focus-mode .focus-optional {
  display: none;
}

#reader.focus-mode .header h1 {
  font-size: 16px;
}

#reader.focus-mode .nav-bar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#reader.focus-mode .reader-panel {
  background:
    linear-gradient(180deg, rgba(18, 22, 29, 0.8), rgba(10, 13, 18, 0.78));
}

.reader-placeholder {
  color: var(--text-secondary);
}

.resume-card {
  width: 100%;
}

.empty-state {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.is-current {
  border-color: rgba(116, 242, 206, 0.44);
  background: rgba(116, 242, 206, 0.12);
}

.is-selected {
  border-color: rgba(255, 196, 107, 0.52);
  background: rgba(255, 196, 107, 0.1);
}

.is-favorite .list-item-icon,
.favorite-on {
  color: var(--accent-warm);
}

.hidden {
  display: none !important;
}
