:root {
  --radius-sm: 10px;
}

.page {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

main { flex: 1; }

.ad-slot { margin-bottom: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-body { padding: 20px; }

.block { margin-bottom: 18px; }
.block:last-child { margin-bottom: 0; }
.block-label {
  font-size: 12px; font-weight: 600; color: var(--sub);
  letter-spacing: 0.06em; margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.block-label b { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--ink); }

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit; font-size: 14px;
  background: var(--bg); color: var(--ink);
  resize: vertical; outline: none;
  transition: border-color 140ms, box-shadow 140ms;
  line-height: 1.7;
}
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8,145,178,0.15);
  background: var(--surface);
}
textarea::placeholder { color: var(--muted); }

.slider-row { display: flex; align-items: center; gap: 10px; }
input[type="range"] {
  -webkit-appearance: none; flex: 1; height: 4px;
  border-radius: 2px; background: var(--border); outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--accent);
  border: 2px solid var(--accent-deep); box-shadow: 0 1px 4px rgba(0,0,0,0.2); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--accent-deep); cursor: pointer;
}
.slider-label { font-size: 11px; color: var(--muted); white-space: nowrap; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--sub);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background 140ms, border-color 140ms, color 140ms; user-select: none;
}
.chip:hover { background: var(--hover); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); font-weight: 700;
}

.start-btn {
  appearance: none; width: 100%; border: none;
  background: var(--accent); color: #fff;
  font-family: "Noto Sans JP", sans-serif; font-weight: 700; font-size: 15px;
  letter-spacing: 0.04em; padding: 14px 20px; border-radius: var(--radius-sm);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 140ms, transform 140ms, opacity 140ms;
}
.start-btn:hover:not(:disabled) { background: var(--accent-deep); transform: translateY(-1px); }
.start-btn:active:not(:disabled) { transform: translateY(0); }
.start-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }


#promptOverlay {
  display: none; position: fixed; inset: 0;
  z-index: 9999; background: #111; flex-direction: column;
}
#promptOverlay.visible { display: flex; }

#promptBar {
  position: absolute; top: 0; left: 0; right: 0; height: 56px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 20px; gap: 12px; z-index: 2;
  opacity: 0; transition: opacity 300ms ease;
}
#promptOverlay:hover #promptBar,
#promptOverlay.show-bar #promptBar { opacity: 1; }

.bar-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.15); color: #fff;
  border: none; cursor: pointer; display: grid; place-items: center;
  transition: background 140ms; backdrop-filter: blur(4px);
}
.bar-btn:hover { background: rgba(255,255,255,0.3); }

#promptScroll {
  flex: 1; overflow-y: auto; overflow-x: clip;
  padding: 10vh 12% 80vh; scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
}
#promptScroll.auto-mode { overflow-y: hidden; }

#promptText {
  font-family: "Noto Sans JP", sans-serif; font-weight: 500;
  color: #f0f0f0; line-height: 2;
  white-space: pre-wrap; word-break: break-word;
}

#pauseFlash {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; z-index: 3;
}
#pauseFlash .flash-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  color: #fff; backdrop-filter: blur(6px);
}
#pauseFlash.show { animation: flashFade 600ms ease forwards; }
@keyframes flashFade {
  0%   { opacity: 1; }
  40%  { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 900px) {
  main { padding: 0; }
  #promptScroll { padding: 8vh 6% 80vh; }
}
