:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ---------- HOME ---------- */
#home { padding: 36px 32px 20px; justify-content: space-between; }
.home-hero { margin-top: 8px; }
.home-kicker {
  letter-spacing: 6px; font-size: 16px; font-weight: 700;
  color: var(--accent); margin-bottom: 10px;
}
.home-title { font-size: 40px; line-height: 1.05; font-weight: 800; }
.home-sub { margin-top: 14px; color: var(--text-secondary); font-size: 18px; }

.menu { display: flex; flex-direction: column; gap: 12px; }
.menu-item {
  display: flex; align-items: center; gap: 16px;
  min-height: 72px; padding: 0 22px;
  background: var(--bg-tertiary); color: var(--text-primary);
  border-radius: var(--radius-md); font-size: 21px; font-weight: 600;
  text-align: left;
}
.menu-icon {
  font-size: 24px; color: var(--accent);
  width: 30px; text-align: center; flex-shrink: 0;
}
.hint-bar {
  text-align: center; color: var(--text-muted); font-size: 14px;
  padding-top: 8px;
}

/* ---------- VIEWER ---------- */
#viewer { background: #000; }
.viewer-media {
  position: relative; width: 100%; height: 312px;
  background: var(--bg-primary); overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.viewer-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.starfield {
  position: absolute; inset: 0;
  background-color: #05060c;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff, transparent),
    radial-gradient(1px 1px at 38% 64%, #cfe8ff, transparent),
    radial-gradient(1px 1px at 70% 18%, #ffffff, transparent),
    radial-gradient(2px 2px at 84% 72%, #ffffff, transparent),
    radial-gradient(1px 1px at 55% 40%, #aee0ff, transparent),
    radial-gradient(1px 1px at 22% 82%, #ffffff, transparent),
    radial-gradient(1px 1px at 92% 34%, #ffe9c2, transparent),
    radial-gradient(160px 120px at 68% 60%, rgba(70,30,120,0.45), transparent),
    radial-gradient(200px 140px at 25% 30%, rgba(0,80,140,0.35), transparent);
}
.media-note {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 16px; font-size: 14px; color: var(--text-secondary);
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  text-align: center;
}
.media-error {
  position: relative; z-index: 2; color: var(--danger);
  font-size: 16px; font-weight: 600; text-align: center; padding: 0 24px;
}

.viewer-info { padding: 14px 20px 6px; flex: 1; min-height: 0; }
.viewer-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.viewer-date { color: var(--accent); font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.viewer-badge {
  font-size: 12px; font-weight: 700; color: var(--bg-primary);
  background: var(--accent-secondary); padding: 2px 8px; border-radius: 6px;
}
.viewer-badge:empty { display: none; }
.viewer-title {
  font-size: 24px; font-weight: 700; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

.viewer-nav { display: flex; gap: 10px; padding: 8px 16px; }
.viewer-nav:last-child { padding-bottom: 18px; }
.navbtn {
  flex: 1; min-height: 60px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 17px; font-weight: 600;
}
.navbtn-read { background: var(--accent); color: #001018; font-weight: 800; }

/* ---------- DETAIL ---------- */
#detail { padding: 22px 22px 18px; }
.detail-head { flex-shrink: 0; margin-bottom: 10px; }
.detail-date { color: var(--accent); font-size: 14px; font-weight: 700; letter-spacing: 1px; }
.detail-title { font-size: 23px; font-weight: 800; line-height: 1.15; margin-top: 4px; }
.detail-body {
  flex: 1; min-height: 0; overflow-y: auto;
  font-size: 18px; line-height: 1.5; color: var(--text-primary);
  padding-right: 6px; scroll-behavior: smooth;
}
.detail-body::-webkit-scrollbar { width: 6px; }
.detail-body::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
.detail-credit {
  flex-shrink: 0; padding: 8px 0; font-size: 13px;
  color: var(--text-muted); border-top: 1px solid var(--bg-tertiary); margin-top: 6px;
}
.detail-credit:empty { display: none; border: none; }

/* ---------- DATE PICKER ---------- */
.scr-header {
  font-size: 26px; font-weight: 800; padding: 26px 24px 10px;
  flex-shrink: 0;
}
.dp-display {
  text-align: center; font-size: 30px; font-weight: 800; color: var(--accent);
  padding: 18px 0; margin: 0 24px 6px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
}
.dp-grid { display: flex; flex-direction: column; gap: 12px; padding: 6px 24px; flex: 1; }
.dp-field { display: flex; align-items: center; gap: 14px; }
.dp-fieldlabel {
  flex: 1; text-align: center; font-size: 19px; color: var(--text-secondary);
}
.dp-fieldlabel b { color: var(--text-primary); font-size: 22px; }
.dp-step {
  width: 76px; height: 64px; flex-shrink: 0;
  background: var(--bg-tertiary); color: var(--text-primary);
  border-radius: var(--radius-md); font-size: 30px; font-weight: 700;
}

/* ---------- ABOUT ---------- */
.about-body { flex: 1; padding: 8px 26px; overflow-y: auto; }
.about-body p { font-size: 18px; line-height: 1.55; margin-bottom: 16px; color: var(--text-primary); }
.about-muted { color: var(--text-muted); font-size: 15px !important; }

/* ---------- OVERLAY ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(5, 6, 12, 0.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.spinner {
  width: 54px; height: 54px; border-radius: 50%;
  border: 4px solid var(--bg-tertiary); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-text { color: var(--text-secondary); font-size: 17px; }
