:root {
  --bg: #080b13;
  --bg-soft: rgba(16, 21, 38, 0.82);
  --surface: rgba(20, 28, 49, 0.88);
  --surface-strong: #11182d;
  --text: #edf3ff;
  --muted: #9aa9c9;
  --accent: #8bb8ff;
  --accent-strong: #4d8df2;
  --gold: #e2be64;
  --danger: #ec6d79;
  --radius: 16px;
  --shadow: 0 20px 55px rgba(8, 10, 22, 0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background:
    radial-gradient(80% 55% at 50% 0%, rgba(77, 141, 242, 0.18), transparent),
    radial-gradient(50% 35% at 100% 100%, rgba(226, 190, 100, 0.08), transparent),
    var(--bg);
}

.home-link {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 30;
  color: var(--muted);
  font-size: 0.76rem;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.home-link:hover { color: var(--accent); }

.layout {
  max-width: 940px;
  margin: 0 auto;
  padding: 48px 20px 44px;
  display: grid;
  gap: 22px;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.lead {
  margin: 10px 0 0;
  max-width: 42rem;
  color: var(--muted);
}

.slot-panel,
.editor {
  background: var(--bg-soft);
  border: 1px solid rgba(139, 184, 255, 0.16);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  padding: 18px;
}

.slot-panel h2,
.editor h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.slot {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  min-height: 148px;
  border: 1px solid rgba(139, 184, 255, 0.2);
  background: linear-gradient(180deg, rgba(77, 141, 242, 0.12), rgba(17, 24, 45, 0.85));
}

.slot::before,
.slot::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 24%;
  z-index: 4;
  pointer-events: none;
}

.slot::before {
  top: 0;
  background: linear-gradient(180deg, rgba(8, 11, 19, 0.9), transparent);
}

.slot::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(8, 11, 19, 0.9), transparent);
}

.slot__track {
  display: grid;
  gap: 6px;
  padding: 10px;
  transition: transform 140ms linear;
  will-change: transform;
}

.slot__item {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  color: rgba(237, 243, 255, 0.72);
  background: rgba(17, 24, 45, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.98rem;
}

.slot__item--active {
  font-size: clamp(1.15rem, 2.7vw, 1.6rem);
  color: #f7fbff;
  border-color: rgba(139, 184, 255, 0.45);
  background: rgba(77, 141, 242, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 25px rgba(77, 141, 242, 0.27);
  letter-spacing: 0.01em;
  font-weight: 650;
}

.slot.is-spinning .slot__item--active {
  animation: pulse 260ms ease-in-out infinite alternate;
}

@keyframes pulse {
  from { filter: brightness(0.95); }
  to { filter: brightness(1.2); }
}

.slot-meta {
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.slot-meta p { margin: 0; }
.slot-meta span { color: rgba(154, 169, 201, 0.8); }
.slot-meta strong { color: var(--text); font-weight: 650; }

.actions,
.control-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(139, 184, 255, 0.26);
  background: rgba(17, 24, 45, 0.78);
  color: var(--text);
  border-radius: 11px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 80ms ease-out, background-color 140ms ease-out, border-color 140ms ease-out;
}

.btn:hover {
  border-color: rgba(139, 184, 255, 0.45);
  background: rgba(30, 39, 67, 0.94);
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(160deg, #4d8df2, #315fd8);
  border-color: rgba(139, 184, 255, 0.55);
}

.btn--primary:hover {
  background: linear-gradient(160deg, #63a0ff, #3f71f0);
}

.controls {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

label { font-size: 0.88rem; color: var(--muted); }

select,
textarea {
  width: 100%;
  margin-top: 6px;
  border-radius: 10px;
  border: 1px solid rgba(139, 184, 255, 0.22);
  color: var(--text);
  background: var(--surface-strong);
  font: inherit;
}

select {
  padding: 10px;
}

textarea {
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
  min-height: 240px;
}

textarea:focus,
select:focus,
.btn:focus-visible {
  outline: 2px solid rgba(139, 184, 255, 0.8);
  outline-offset: 2px;
}

.textarea-label { display: block; margin-top: 4px; }

.hint {
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.86rem;
  color: var(--gold);
}

.status.is-error {
  color: var(--danger);
}

body.obs-mode {
  background: #03060d;
}

body.obs-mode .home-link,
body.obs-mode .app-header,
body.obs-mode .editor {
  display: none;
}

/* 終了ボタンは隠さず隅に残す（以前は display:none で抜け出せなくなっていた） */
body.obs-mode #obs-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 20;
  opacity: 0.35;
  background: rgba(10, 16, 28, 0.72);
  border-color: rgba(255, 255, 255, 0.18);
}

body.obs-mode #obs-btn:hover,
body.obs-mode #obs-btn:focus-visible {
  opacity: 1;
}

body.obs-mode .layout {
  max-width: min(90vw, 1280px);
  min-height: 100vh;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.obs-mode .slot-panel {
  width: min(90vw, 1180px);
  padding: 26px;
}

body.obs-mode .slot-panel h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

body.obs-mode .slot {
  min-height: min(54vh, 430px);
}

body.obs-mode .slot__item {
  min-height: 82px;
  font-size: 1.65rem;
}

body.obs-mode .slot__item--active {
  font-size: clamp(2rem, 3.4vw, 3.25rem);
}

body.obs-mode .slot-meta {
  font-size: 1rem;
}

body.obs-mode .actions {
  margin-top: 20px;
}

@media (max-width: 680px) {
  .layout { padding: 42px 14px 20px; }
  .slot-panel, .editor { padding: 14px; }
  .slot__item--active { font-size: 1.08rem; }
  .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .slot__track,
  .btn,
  .slot.is-spinning .slot__item--active {
    transition: none !important;
    animation: none !important;
  }
}
