:root {
  --bg: #0d0d0f;
  --surface: rgba(24, 25, 29, 0.88);
  --surface-strong: rgba(30, 31, 36, 0.96);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --field: rgba(12, 13, 16, 0.9);
  --text: #f2ede4;
  --text-dim: #b5aa9c;
  --text-faint: #837b72;
  --accent: #d8a554;
  --accent-2: #75bfb9;
  --accent-3: #8aa86f;
  --pc: #91bfe2;
  --danger: #df7e68;
  --border: rgba(242, 226, 196, 0.16);
  --border-strong: rgba(242, 226, 196, 0.28);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  --radius: 8px;
  --tap: 44px;
  /* 物語を読ませる面は明朝体で組む。和文は各OSの明朝、欧文・数字も明朝に寄せる */
  --serif:
    "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", YuMincho,
    "Noto Serif JP", "Shippori Mincho", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.72;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 物語として読む面は明朝体に。操作UI(ボタン/ラベル/ヘッダー)はゴシックのまま残す */
.lead,
.sc-teaser,
.scenario-opening,
.world-intro-body h2,
#story-title,
.story-day-title,
.story-prose,
.story-action p,
.story-intent p,
.story-conflict,
#ending-box h2,
#ending-epilogue {
  font-family: var(--serif);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    radial-gradient(66% 58% at 8% -12%, color-mix(in srgb, var(--accent) 21%, transparent), transparent 72%),
    radial-gradient(54% 64% at 98% 10%, color-mix(in srgb, var(--accent-2) 11%, transparent), transparent 74%),
    radial-gradient(48% 46% at 64% 104%, color-mix(in srgb, var(--accent-3) 9%, transparent), transparent 75%),
    linear-gradient(145deg, #101015 0%, #0d0d0f 43%, #09090b 100%);
  opacity: 1;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 5px
    ),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.28));
  mix-blend-mode: soft-light;
  opacity: 0.42;
}

body[data-screen="day"]::before {
  opacity: 0.24;
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 10px 16px;
  color: #15100a;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 48%),
    var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  font-weight: 760;
  font-size: 15px;
  line-height: 1.25;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}

button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
  filter: grayscale(0.2);
  transform: none;
}

button.secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--border);
  box-shadow: none;
}

button.secondary:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.075);
  filter: none;
}

button.secondary.danger,
button.danger {
  color: #ffd7ce;
  border-color: rgba(223, 126, 104, 0.46);
}

textarea,
input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--text);
  background: var(--field);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-size: 16px;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

textarea::placeholder,
input::placeholder {
  color: rgba(242, 237, 228, 0.38);
}

textarea:focus,
input:focus,
select:focus,
button:focus-visible,
.scenario-card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, white);
  outline-offset: 2px;
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.55;
}

strong {
  color: #fff8ea;
}

.hidden {
  display: none !important;
}

.status {
  min-height: 1.45em;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
}

#landing-status:empty {
  display: none;
}

.status.error {
  color: #ffd6ca;
  border: 1px solid rgba(223, 126, 104, 0.4);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: rgba(70, 30, 25, 0.74);
}

.status.working {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f4cf83;
}

.status.working::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 72%, transparent);
  animation: flame-flicker 1.4s ease-in-out infinite;
}

.status .elapsed {
  color: var(--text-faint);
  font-size: 12px;
}

@keyframes flame-flicker {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  42% {
    opacity: 0.38;
    transform: scale(0.72);
  }
  68% {
    opacity: 0.86;
    transform: scale(1.08);
  }
}

.screen {
  position: relative;
  z-index: 1;
}

.account-panel {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 13, 15, 0.9);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.account-toggle {
  width: 100%;
  justify-content: space-between;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  box-shadow: none;
  font-size: 14px;
}

.account-toggle::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

body.account-panel-open .account-toggle::after {
  transform: translateY(3px) rotate(225deg);
}

.account-content {
  display: none;
  padding-top: 10px;
}

body.account-panel-open .account-content {
  display: block;
}

/* サインインしたらログイン用のトグル/フォームは隠し、チップだけ残す。
   重たいカードの装飾も外して、隅に静かに収まるようにする。 */
body.is-signed-in .account-toggle,
body.is-signed-in .account-content {
  display: none;
}

body.is-signed-in .account-panel {
  width: auto;
  border: none;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.auth-tab {
  min-height: 36px;
  padding: 7px 10px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--border);
  box-shadow: none;
  font-size: 13px;
}

.auth-tab.selected {
  color: #17110a;
  background: var(--accent);
  border-color: rgba(255, 255, 255, 0.12);
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.auth-grid input {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 14px;
}

#btn-auth-submit,
#btn-logout {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
}

/* ログインはパネル内の補助動作。主役CTA(この世界を立てる)より一段静かな金に。 */
#btn-auth-submit {
  color: color-mix(in srgb, var(--accent) 88%, white);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 52%, transparent);
  box-shadow: none;
  font-weight: 740;
}

#btn-auth-submit:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent) 68%, transparent);
  filter: none;
}

/* サインイン中はアバター付きの小さなチップに畳み、押すとメニューが開く */
.account-user {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  min-height: 42px;
  padding: 5px 13px 5px 6px;
  color: var(--text);
  background: rgba(13, 13, 15, 0.72);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(14px);
  font-size: 13px;
  font-weight: 720;
}

.account-chip:hover {
  border-color: var(--border-strong);
  transform: none;
  filter: none;
}

.account-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 76%, #ffe7b4), var(--accent));
  color: #1a1209;
  font-size: 14px;
  font-weight: 860;
  line-height: 1;
}

.account-name {
  min-width: 0;
  max-width: 152px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-caret {
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: 1px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.16s ease;
}

.account-chip[aria-expanded="true"] .account-caret {
  transform: translateY(1px) rotate(225deg);
}

.account-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 5;
  min-width: 224px;
  max-width: min(82vw, 300px);
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.account-menu-id {
  margin: 4px 8px 8px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

.account-menu-item {
  width: 100%;
  justify-content: flex-start;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}

.account-menu-item:hover {
  color: #fff;
  background: color-mix(in srgb, var(--danger) 24%, transparent);
  transform: none;
  filter: none;
}

#account-status {
  min-height: 0;
  margin: 8px 0 0;
}

#screen-landing,
#screen-lobby {
  min-height: calc(100svh - 86px);
  padding: 28px 16px 42px;
}

#screen-landing {
  padding-bottom: 128px;
}

.narrow-box {
  width: min(100%, 680px);
  margin: 0 auto;
}

#screen-landing .narrow-box {
  width: min(100%, 1040px);
}

.eyebrow {
  width: fit-content;
  margin: 0 0 10px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent-2);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  font-weight: 720;
}

.narrow-box h1 {
  margin: 0;
  color: #fff7e8;
  /* ワードマークは明朝/セリフで。favicon・OG画像と同じ書体に揃える。 */
  font-family: Georgia, "Hiragino Mincho ProN", var(--serif);
  font-size: 46px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.subtitle {
  max-width: 640px;
  margin: 8px 0 0;
  color: var(--accent-2);
  font-size: 16px;
  font-weight: 640;
  line-height: 1.6;
}

.lead {
  max-width: 680px;
  margin: 22px 0 28px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  color: #e9dfd0;
  font-size: 14px;
}

.fineprint,
.field-note {
  color: var(--text-faint);
  font-size: 12px;
}

.fineprint {
  margin: 14px 0 0;
}

.field {
  margin: 20px 0;
}

#deadline-hour {
  width: auto;
  min-width: 132px;
}

.deadline-display {
  font-weight: 600;
  font-size: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  min-height: 34px;
  padding: 5px 13px 5px 9px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: none;
  font-size: 12.5px;
  font-weight: 700;
}

.back-link::before {
  content: "‹";
  margin-top: -2px;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.back-link:hover {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--border-strong);
  transform: none;
  filter: none;
}

#screen-lobby .back-link {
  margin-bottom: 18px;
}

#day-header .back-link {
  margin-bottom: 9px;
}

.narrow-box h3 {
  margin: 28px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 760;
}

.scenario-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0;
  margin: 10px 0 14px;
  list-style: none;
}

.scenario-card {
  --card-accent: #d8a554;
  --card-wash: color-mix(in srgb, var(--card-accent) 12%, transparent);
  position: relative;
  min-height: 152px;
  overflow: hidden;
  padding: 16px 15px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, var(--card-wash), transparent 52%),
    rgba(22, 23, 27, 0.82);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.scenario-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--card-accent), transparent);
}

/* 右下に静かな三日月。物語/夜の気配を添える(以前の照準モチーフを置き換え)。 */
.scenario-card::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset -8px 4px 0 -1px color-mix(in srgb, var(--card-accent) 58%, transparent);
  opacity: 0.5;
}

.scenario-card:hover,
.scenario-card.selected {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--card-accent) 74%, transparent);
  background:
    linear-gradient(135deg, var(--card-wash), transparent 54%),
    rgba(32, 33, 38, 0.92);
}

.scenario-card.selected {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--card-accent) 42%, transparent),
    0 18px 44px rgba(0, 0, 0, 0.34);
}

.scenario-card .sc-title {
  position: relative;
  z-index: 1;
  color: #fff7e8;
  font-size: 18px;
  font-weight: 820;
  line-height: 1.35;
}

.scenario-card .sc-genre {
  position: relative;
  z-index: 1;
  width: fit-content;
  margin: 7px 0 9px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--card-accent) 46%, transparent);
  border-radius: 999px;
  color: color-mix(in srgb, var(--card-accent) 82%, white);
  background: rgba(0, 0, 0, 0.18);
  font-size: 12px;
  line-height: 1.35;
}

.scenario-card .sc-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.scenario-card .sc-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.scenario-card .sc-cat {
  flex: none;
  margin-top: 2px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
  color: #14151a;
  background: color-mix(in srgb, var(--card-accent) 80%, white);
}

.scenario-card .sc-cat[data-category="謎解き"] {
  color: #f3ecdd;
  background: rgba(126, 110, 196, 0.92);
}

.scenario-card .sc-cat[data-category="対戦"] {
  color: #f6e7e1;
  background: rgba(198, 92, 84, 0.94);
}

.scenario-card .sc-selected-label {
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--card-accent) 72%, white);
  border-radius: 999px;
  color: #19130b;
  background: color-mix(in srgb, var(--card-accent) 58%, white);
  font-size: 10px;
  font-weight: 860;
  line-height: 1.3;
  white-space: nowrap;
}

.scenario-card .sc-tagline {
  position: relative;
  z-index: 1;
  display: -webkit-box;
  overflow: hidden;
  color: #ddd2c2;
  font-size: 13px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.scenario-card .sc-tags {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.scenario-card .sc-tag {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #b6ab9b;
  background: rgba(0, 0, 0, 0.22);
  font-size: 11px;
  line-height: 1.4;
}

/* シナリオ絞り込みフィルタ */
.scenario-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0 10px;
}

.filter-section {
  display: grid;
  gap: 7px;
}

.filter-section-tags {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.filter-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-label {
  margin: 0;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.06em;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filter-row[hidden] {
  display: none;
}

.filter-row-tags {
  margin-top: 1px;
}

.filter-disclosure,
.filter-reset {
  min-height: 30px;
  padding: 4px 9px;
  color: var(--accent-2);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  font-size: 11.5px;
  font-weight: 760;
}

.filter-disclosure:hover,
.filter-reset:hover {
  color: #e9f8f4;
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  filter: none;
  transform: none;
}

.filter-reset {
  width: fit-content;
  margin-top: -2px;
  color: var(--text-dim);
}

.filter-chip {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  background: rgba(22, 23, 27, 0.7);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.filter-chip:hover {
  color: #ece2d2;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

.filter-chip-cat.is-active {
  color: #14151a;
  border-color: transparent;
  background: var(--accent);
}

.filter-chip-tag.is-active {
  color: #fff7e8;
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.scenario-count {
  margin: 0 0 8px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}

.selection-kicker,
.landing-cta-kicker {
  display: block;
  margin: 0 0 3px;
  color: var(--accent-2);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.selection-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.scenario-intro-dialog {
  width: min(calc(100vw - 32px), 680px);
  max-height: min(760px, calc(100svh - 32px));
  overflow: auto;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 58%, var(--border));
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  color: var(--text);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 13%, transparent), transparent 56%),
    var(--surface-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.56);
}

.scenario-intro-dialog::backdrop {
  background: rgba(5, 5, 7, 0.72);
  backdrop-filter: blur(5px);
}

.scenario-intro-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.scenario-intro-dialog .selection-heading h2 {
  margin: 0;
  color: #fff5e5;
  font-family: var(--serif);
  font-size: clamp(24px, 5vw, 31px);
  font-weight: 780;
  line-height: 1.35;
}

.scenario-intro-close {
  min-height: 32px;
  padding: 5px 10px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--border);
  box-shadow: none;
  font-size: 12px;
}

.scenario-intro-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  filter: none;
  transform: none;
}

.selection-category {
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 56%, transparent);
  border-radius: 999px;
  color: color-mix(in srgb, var(--accent) 84%, white);
  background: rgba(0, 0, 0, 0.16);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.35;
}

.selection-tagline {
  margin: 7px 0 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.65;
}

.scenario-empty {
  margin: 6px 0 14px;
  padding: 14px 15px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

.scenario-opening {
  margin: 12px 0 18px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  color: #e7ded0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 50%),
    rgba(18, 19, 23, 0.82);
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-line;
}

.scenario-opening:empty {
  display: none;
}

.scenario-intro-dialog .scenario-opening {
  margin: 17px 0 0;
}

.landing-cta-dock {
  position: fixed;
  right: max(16px, calc((100vw - 760px) / 2));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 25;
  width: min(100% - 32px, 580px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 9px 9px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 62%, var(--border));
  border-radius: 14px;
  background:
    linear-gradient(110deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 58%),
    rgba(18, 19, 23, 0.94);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(18px);
}

.landing-cta-copy {
  min-width: 0;
}

.landing-cta-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.landing-cta-title {
  display: block;
  overflow: hidden;
  color: #fff7e8;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.landing-cta-dock #btn-create {
  min-height: 48px;
  padding: 10px 17px;
  font-size: 14px;
  box-shadow:
    0 9px 21px rgba(0, 0, 0, 0.28),
    0 0 20px color-mix(in srgb, var(--accent) 22%, transparent);
}

.landing-cta-intro {
  min-height: 40px;
  padding: 7px 9px;
  color: var(--accent-2);
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--border);
  box-shadow: none;
  font-size: 12px;
  font-weight: 760;
}

.landing-cta-intro:hover {
  color: #ecfffa;
  border-color: color-mix(in srgb, var(--accent-2) 70%, transparent);
  background: color-mix(in srgb, var(--accent-2) 13%, transparent);
  filter: none;
}

.landing-cta-dock #btn-create:disabled {
  box-shadow: none;
}

.my-games {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.my-games li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(22, 23, 27, 0.72);
}

.my-games-title {
  color: #fff3df;
  font-weight: 760;
}

.my-games-meta {
  color: var(--text-faint);
  font-size: 12px;
}

.my-games button {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 12px;
}

.invite {
  margin: 22px 0 24px;
}

.invite-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.invite-row input {
  color: var(--accent-2);
  font-size: 13px;
}

.player-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.player-list li {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(20, 21, 25, 0.76);
}

.player-list .pl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.player-list .pl-name {
  color: #fff4df;
  font-weight: 780;
}

.player-list .pl-name.you {
  color: color-mix(in srgb, var(--accent) 84%, white);
}

.player-list .badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.045);
  font-size: 11px;
}

.player-list .pl-desc {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.65;
}

.you-joined {
  color: var(--accent-2);
  font-weight: 680;
}

#join-box,
#waiting-box {
  margin-top: 10px;
}

.lobby-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 12px 0 4px;
}

.link-danger {
  min-height: 30px;
  margin-left: auto;
  padding: 3px 8px;
  color: #ffd2c7;
  background: rgba(223, 126, 104, 0.08);
  border-color: rgba(223, 126, 104, 0.3);
  box-shadow: none;
  font-size: 12px;
}

#screen-day {
  width: min(100%, 980px);
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(13, 13, 15, 0.58), rgba(13, 13, 15, 0.88));
}

#day-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 13, 15, 0.92);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px);
}

.day-header-main {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 12px;
}

.day-no {
  color: color-mix(in srgb, var(--accent) 86%, white);
  font-size: 24px;
  font-weight: 860;
  line-height: 1.1;
}

.countdown {
  margin-top: 4px;
  color: var(--accent-2);
  font-size: 13px;
}

.reply-status {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 0 0;
  margin: 8px 0 0;
  list-style: none;
}

.reply-status li {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.reply-status .dot {
  margin-right: 5px;
}

.reply-status .replied .dot {
  color: var(--accent-2);
}

.reply-status .waiting .dot {
  color: var(--text-faint);
}

.reply-status .me {
  color: color-mix(in srgb, var(--accent) 72%, white);
  border-color: color-mix(in srgb, var(--accent) 36%, transparent);
}

#day-main {
  flex: 1;
  padding: 16px 14px 132px;
}

#world-intro,
#party,
#record,
#decision-box,
#ending-box {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

#world-intro summary,
#party summary,
#record summary {
  color: var(--accent-2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 760;
}

#world-intro[open] summary,
#party[open] summary,
#record[open] summary {
  margin-bottom: 12px;
}

.world-intro-body h2 {
  margin: 0 0 4px;
  color: #fff2dc;
  font-size: 18px;
}

.world-intro-genre {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 13px;
}

.world-intro-body .scenario-opening {
  margin-bottom: 0;
}

#party .player-list li:last-child {
  margin-bottom: 0;
}

#decision-box {
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 50%),
    rgba(29, 25, 18, 0.88);
}

#decision-question {
  margin: 0 0 12px;
  color: #ffe1a6;
  font-weight: 760;
}

#decision-options {
  display: grid;
  gap: 8px;
}

.decision-option {
  justify-content: flex-start;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  box-shadow: none;
}

.decision-option:hover {
  border-color: var(--accent);
}

.decision-option strong {
  display: block;
}

.decision-option .opt-hint {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 12px;
}

.decision-note {
  margin-bottom: 0;
  color: var(--text-faint);
  font-size: 12px;
}

#ending-box {
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 58%),
    rgba(30, 25, 17, 0.9);
}

#ending-box h2 {
  margin: 0 0 10px;
  color: #ffe0a1;
  font-size: 22px;
  font-weight: 820;
}

#ending-epilogue {
  white-space: pre-wrap;
}

.ending-kicker {
  margin: 0 0 4px;
  font-size: 0.8em;
  letter-spacing: 0.08em;
  color: var(--muted, #9a8f73);
  text-transform: none;
}

#story-panel {
  margin: 22px 0;
}

.story-panel-head {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

#story-title {
  margin: 0;
  color: #fff3df;
  font-size: 24px;
  font-weight: 860;
  line-height: 1.2;
}

#story-note {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.story-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.story-jump-btn {
  min-height: 34px;
  padding: 5px 10px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--border);
  border-radius: 999px;
  box-shadow: none;
  font-size: 12px;
}

.story-empty {
  padding: 12px 0;
  color: var(--text-faint);
  font-size: 14px;
}

.story-stream {
  display: grid;
  gap: 12px;
}

.story-day {
  scroll-margin-top: 120px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(22, 23, 27, 0.78);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.story-day.current {
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 55%),
    rgba(27, 28, 33, 0.92);
}

.story-day summary {
  display: grid;
  gap: 3px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.story-day-title {
  color: color-mix(in srgb, var(--accent) 84%, white);
  font-size: 16px;
  font-weight: 820;
}

.story-day-sub {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 640;
}

.story-prose {
  margin: 0;
  padding: 15px 14px 0;
  color: #eee5d8;
  font-size: 16px;
  line-height: 1.95;
  white-space: pre-wrap;
}

.story-action,
.story-intent {
  margin: 15px 14px 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.story-action {
  color: #d5edf0;
}

.story-intent {
  margin-bottom: 14px;
  color: var(--text-dim);
  border-left-color: var(--border-strong);
}

.story-action p,
.story-intent p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.story-mini-label {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 760;
}

.story-conflict {
  margin: 14px;
  color: #ffd0c5;
  font-size: 14px;
  font-style: italic;
  line-height: 1.75;
}

#input-area {
  position: sticky;
  bottom: 0;
  z-index: 7;
  margin: 20px -14px 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-right: 0;
  border-left: 0;
  background: rgba(13, 13, 15, 0.94);
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.input-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  margin-bottom: 10px;
  padding: 4px 10px;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.input-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.input-toggle-caret {
  font-size: 10px;
  transition: transform 0.18s ease;
}

#input-area.collapsed {
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.28);
}

#input-area.collapsed #input-body {
  display: none;
}

#input-area.collapsed .input-toggle {
  margin-bottom: 0;
}

#input-area.collapsed .input-toggle-caret {
  transform: rotate(180deg);
}

#intent-label {
  margin-bottom: 8px;
  color: #cfc3b3;
  font-size: 12px;
}

#intent-guidance {
  display: block;
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.6;
}

#input-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

#intent {
  /* 短文も受け止めつつ、慣れた人が意図の背景まで書ける初期サイズにする。 */
  min-height: 176px;
  height: clamp(176px, 28svh, 244px);
  max-height: 52svh;
}

#buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#buttons button {
  width: 100%;
}

#reply-note {
  color: var(--accent-2);
}

.day-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.day-tools button {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 12px;
}

#record {
  margin-top: 14px;
}

#record h3 {
  margin: 14px 0 6px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 760;
}

#facts {
  padding-left: 18px;
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}

#facts li {
  margin-bottom: 6px;
}

#world-state {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.story-top-button {
  position: fixed;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom) + 92px);
  z-index: 9;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--text);
  background: rgba(13, 13, 15, 0.88);
  border-color: var(--border);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
  font-size: 12px;
}

@media (min-width: 560px) {
  .invite-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .my-games li {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .lobby-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-panel-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .story-jump {
    justify-content: flex-end;
    max-width: 430px;
  }

  #input-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  #buttons {
    min-width: 132px;
  }
}

@media (min-width: 760px) {
  body::before {
    opacity: 1;
  }

  #screen-landing,
  #screen-lobby {
    min-height: 100svh;
    padding: 72px 26px 70px;
  }

  .narrow-box h1 {
    font-size: 64px;
  }

  .subtitle {
    font-size: 18px;
  }

  .lead {
    font-size: 15px;
  }

  .scenario-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scenario-card {
    min-height: 184px;
    padding: 18px;
  }

  #screen-lobby .narrow-box {
    width: min(100%, 760px);
  }

  #day-header {
    padding: 14px 22px;
  }

  #day-main {
    padding: 24px 22px 150px;
  }

  #world-intro,
  #party,
  #record,
  #decision-box,
  #ending-box {
    padding: 16px 18px;
  }

  .story-stream {
    gap: 16px;
  }

  .story-day summary {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    padding: 15px 18px;
  }

  .story-prose {
    padding: 18px 18px 0;
    font-size: 17px;
    line-height: 2;
  }

  .story-action,
  .story-intent {
    margin-right: 18px;
    margin-left: 18px;
  }

  #input-area {
    margin-right: -22px;
    margin-left: -22px;
    padding: 16px 22px;
  }

  .story-top-button {
    right: max(18px, calc((100vw - 980px) / 2 + 18px));
    bottom: 18px;
  }
}

@media (min-width: 900px) {
  .account-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    width: auto;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
  }

  .account-toggle {
    width: auto;
    min-width: 140px;
    padding: 9px 12px;
    border-radius: 999px;
  }

  .account-content {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(360px, calc(100vw - 32px));
    padding: 14px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
  }

  #screen-landing {
    padding-top: 82px;
  }

  body.is-signed-in .account-panel {
    padding: 0;
  }
}

@media (min-width: 1120px) {
  #screen-landing .narrow-box {
    padding-right: 0;
  }

  /* 3列。和文タイトルが途中で折り返さない幅を確保する(4列は1400px以上)。 */
  .scenario-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .scenario-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
