:root {
  --bg: #000000;            /* 加算式ディスプレイでは透明 */
  --surface: #10141c;
  --surface-2: #1a2230;
  --line: #232b3a;
  --text: #ffffff;
  --text-2: #b0b3b8;
  --text-3: #8b93a3;
  --dim: #59627a;
  --accent: #4fd8ff;
  --warn: #ffcf4d;
  --danger: #ff5d6e;
  --ok: #4dffa6;
}

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

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

#stage { width: 600px; height: 600px; position: relative; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 32px 20px;
}
.screen.center { justify-content: center; }
.screen.center > :first-child { margin-top: auto; }
.hidden { display: none !important; }

/* --- 見出し・テキスト --- */
.logo { font-size: 34px; font-weight: 700; letter-spacing: 1px; }
.logo-accent { color: var(--accent); }
.tagline { color: var(--text-2); font-size: 16px; margin: 10px 0 30px; }
.screen-title { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.section-label { color: var(--text-3); font-size: 14px; margin: 14px 0 6px; }
.muted { color: var(--text-3); }
.small { font-size: 13px; line-height: 1.5; }
.c-yellow { color: var(--warn); font-weight: 700; }
.c-red { color: var(--danger); font-weight: 700; }
.hint { color: #5a6270; font-size: 12px; margin-top: auto; padding-top: 10px; }

/* --- メニュー --- */
.menu { list-style: none; width: 380px; max-width: 100%; }
.menu li {
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 13px 20px;
  margin: 9px 0;
  font-size: 18px;
  text-align: center;
  color: #e4e6eb;
  opacity: 0.8;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, opacity .2s, background .2s;
}
.menu li.selected {
  background: var(--surface-2);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(79, 216, 255, 0.35);
  color: #fff;
  opacity: 1;
}
.menu-row { display: flex; gap: 10px; width: 100%; margin-top: 12px; }
.menu-row li { flex: 1; margin: 0; font-size: 16px; }

/* 原稿リスト */
.menu-list { width: 100%; }
.menu-list li { text-align: left; padding: 12px 18px; }
.item-title { display: block; font-size: 17px; font-weight: 600; }
.item-meta { display: block; font-size: 13px; color: var(--text-3); margin-top: 3px; }
.scrolly { overflow-y: auto; flex: 1; min-height: 0; }
.badge {
  display: inline-block;
  background: var(--accent);
  color: #0a0c10;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 9px;
  margin-left: 10px;
  vertical-align: 2px;
}

/* --- プロンプター --- */
.prompter { padding: 20px 28px 8px; }
#p-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
#p-timer {
  font-size: 44px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 2px;
  transition: color .3s;
}
#p-timer.warn { color: var(--warn); }
#p-timer.danger, #p-timer.over { color: var(--danger); }
#p-timer.danger { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
#p-count { font-size: 16px; color: var(--text-3); font-variant-numeric: tabular-nums; }

#p-bar {
  width: 100%;
  height: 8px;
  background: #141a24;
  border-radius: 4px;
  margin: 10px 0 4px;
  overflow: hidden;
}
#p-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  transition: width .2s linear, background .3s;
}
#p-fill.warn { background: var(--warn); }
#p-fill.danger, #p-fill.over { background: var(--danger); }

#p-view {
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
#p-view::before, #p-view::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 56px;
  z-index: 2;
  pointer-events: none;
}
#p-view::before { top: 0; background: linear-gradient(to bottom, #000 0%, transparent 100%); }
#p-view::after { bottom: 0; background: linear-gradient(to top, #000 0%, transparent 100%); }

#p-track {
  position: absolute;
  left: 0; right: 0; top: 0;
  transition: transform .35s cubic-bezier(0.4, 0, 0.2, 1);
}
.para {
  padding: 13px 6px;
  font-size: 21px;
  line-height: 1.65;
  color: var(--dim);
  opacity: 0.55;
  transition: color .3s, opacity .3s;
}
.para.active { color: #fff; opacity: 1; }
.para-end { text-align: center; color: var(--text-3); font-size: 17px; }
#p-hint { margin-top: 2px; padding: 6px 0 4px; }

/* 時間切れフラッシュ */
#p-flash {
  position: absolute;
  inset: 0;
  background: var(--danger);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}
#p-flash.on { animation: flash 0.9s ease-out 2; }
@keyframes flash { 0% { opacity: 0; } 20% { opacity: 0.22; } 100% { opacity: 0; } }

/* ポーズメニュー */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 10, 0.88);
  z-index: 10;
}
.overlay-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 34px 26px;
  text-align: center;
}
.overlay-card h3 { font-size: 20px; margin-bottom: 10px; }
.overlay-card .menu { width: 280px; }

/* --- つかいかた --- */
.howto-body { font-size: 16px; line-height: 1.7; color: var(--text-2); width: 100%; }
.howto-body p { margin: 9px 0; }
.howto-body b { color: #fff; }

/* --- 結果 --- */
.done-stats { display: flex; flex-direction: column; gap: 12px; width: 360px; margin: 14px 0 22px; }
.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-radius: 12px;
  padding: 13px 20px;
}
.stat-label { color: var(--text-3); font-size: 15px; }
.stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value.ok { color: var(--ok); }
.stat-value.over { color: var(--danger); }

/* --- カスタム原稿の編集 --- */
.text-input, .text-area {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-family: inherit;
  padding: 12px 14px;
  margin-top: 10px;
}
.text-area { flex: 1; min-height: 0; resize: none; line-height: 1.6; }
.text-input:focus, .text-area:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(79, 216, 255, 0.3);
}
.text-input::placeholder, .text-area::placeholder { color: #5a6270; }

/* --- トースト --- */
.toast {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-70px);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 10px 22px;
  font-size: 14px;
  z-index: 50;
  transition: transform .3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.visible { transform: translateX(-50%) translateY(0); }
