:root {
  --ink: #1f2230;
  --muted: #5f625f;
  --paper: #f7efe1;
  --panel: rgba(255, 252, 246, 0.9);
  --panel-strong: #fffdf8;
  --line: rgba(31, 34, 48, 0.12);
  --accent: #b85a33;
  --accent-dark: #8d3e1d;
  --accent-soft: rgba(184, 90, 51, 0.12);
  --good: #2f7444;
  --warn: #a56900;
  --bad: #9a2d2d;
  --shadow: 0 24px 60px rgba(31, 34, 48, 0.12);
  font-family: Georgia, "Palatino Linotype", "Book Antiqua", Garamond, serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(184, 90, 51, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(54, 88, 122, 0.11), transparent 24%),
    linear-gradient(180deg, #f8f0e4 0%, #f2e7d6 100%);
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background: transparent;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.shell__header {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: end;
  gap: 1rem;
  padding: 2rem 0 1.25rem;
}

.shell__content {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding-bottom: 3rem;
  flex: 1;
}

.shell__eyebrow,
.eyebrow,
.meta {
  color: var(--muted);
  letter-spacing: 0.04em;
}

.shell__eyebrow,
.eyebrow {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.shell__title,
.page-header h2,
.panel h2,
.progress-card__title {
  color: #1d2f57;
}

.shell__title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  box-shadow: var(--shadow);
  padding: 1.6rem;
  backdrop-filter: blur(12px);
}

.panel--hero {
  padding: 2rem;
}

.panel--centered {
  text-align: center;
}

.panel--tutorial {
  display: grid;
  gap: 1.5rem;
}

.lede {
  max-width: 46rem;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--muted);
}

.lede--centered {
  margin-inline: auto;
}

.page-header {
  margin-bottom: 1rem;
}

.page-header h2,
.panel h2 {
  margin: 0;
}

.actions {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.actions--centered {
  justify-content: center;
}

.study-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem);
  gap: 1.25rem;
  align-items: start;
}

.side-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.tutorial-hero {
  display: grid;
  grid-template-columns: minmax(18rem, 23rem) minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
}

.tutorial-visual,
.tutorial-card,
.tutorial-note,
.progress-card,
.rating-group {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
}

.tutorial-visual,
.tutorial-card,
.tutorial-note,
.progress-card {
  box-shadow: 0 14px 36px rgba(31, 34, 48, 0.08);
}

.tutorial-visual,
.tutorial-card,
.tutorial-note,
.progress-card,
.rating-group {
  padding: 1rem;
}

.tutorial-copy {
  display: grid;
  gap: 1rem;
}

.tutorial-rule-list {
  margin: 0;
  padding-left: 1.3rem;
  display: grid;
  gap: 0.7rem;
  line-height: 1.55;
}

.tutorial-support {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.tutorial-card h3,
.tutorial-note h3 {
  margin: 0 0 0.7rem;
}

.tutorial-card p,
.tutorial-note p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.tutorial-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.consent-frame {
  max-height: 32rem;
  overflow: auto;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 1.25rem;
  margin: 1rem 0;
}

.consent-document {
  line-height: 1.6;
  color: var(--ink);
}

.consent-document h1,
.consent-document h2,
.consent-document h3 {
  color: #1d2f57;
}

.consent-document h1 {
  font-size: 1.7rem;
  margin: 0 0 1rem;
}

.consent-document h2 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.75rem;
}

.consent-document p {
  margin: 0.8rem 0;
}

.form-grid,
.survey-form {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field textarea {
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  padding: 0.9rem 1rem;
  font: inherit;
  color: var(--ink);
  background: white;
}

.checkbox {
  display: flex;
  gap: 0.75rem;
  align-items: start;
}

.checkbox input {
  margin-top: 0.25rem;
}

.button {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(31, 34, 48, 0.12);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(31, 34, 48, 0.16);
}

.button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent-dark);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button--large {
  width: 100%;
  padding-block: 0.95rem;
}

.message {
  padding: 0.9rem 1rem;
  border-radius: 0.95rem;
}

.message--error {
  background: rgba(154, 45, 45, 0.12);
  color: var(--bad);
}

.message--info {
  background: rgba(184, 90, 51, 0.1);
  color: var(--accent-dark);
}

.resume-card {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  box-shadow: 0 14px 36px rgba(31, 34, 48, 0.08);
  padding: 1.2rem;
}

.resume-card h3 {
  margin: 0;
  color: #1d2f57;
}

.board-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.1rem;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 1.3rem;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.board-frame--solved {
  background: linear-gradient(180deg, rgba(232, 247, 236, 0.96), rgba(251, 255, 252, 0.98));
  border-color: rgba(47, 116, 68, 0.35);
  box-shadow: 0 0 0 4px rgba(47, 116, 68, 0.1);
}

.progress-card {
  display: grid;
  gap: 0.85rem;
}

.progress-card--solved {
  background: linear-gradient(180deg, rgba(232, 247, 236, 0.95), rgba(251, 255, 252, 0.98));
  border-color: rgba(47, 116, 68, 0.35);
}

.progress-card__header {
  display: flex;
  justify-content: flex-start;
}

.progress-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(31, 34, 48, 0.08);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
}

.progress-chip--solved {
  background: rgba(47, 116, 68, 0.14);
  color: var(--good);
}

.progress-card__title {
  margin: 0;
  font-size: 1.45rem;
}

.progress-card__body {
  margin: 0;
  line-height: 1.6;
}

.progress-card__body--quiet {
  color: var(--muted);
}

.progress-card__action {
  margin-top: 0.2rem;
}

.akari-board {
  display: grid;
  gap: 0.25rem;
}

.board-frame .akari-board {
  width: 100%;
  max-width: 41rem;
}

.tutorial-showcase,
.tutorial-mini-board {
  padding: 0.45rem;
  background: linear-gradient(180deg, #fffcf6 0%, #f5ecde 100%);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
}

.tutorial-mini-board {
  width: max-content;
  margin-bottom: 0.75rem;
}

.cell {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(31, 34, 48, 0.08);
  border-radius: 0.7rem;
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  user-select: none;
}

.board-frame .cell {
  cursor: pointer;
}

.board-frame .cell[role="button"]:focus-visible {
  outline: 3px solid rgba(29, 47, 87, 0.45);
  outline-offset: 2px;
}

.board-frame .cell[aria-disabled="true"] {
  pointer-events: none;
}

.tutorial-showcase .cell,
.tutorial-mini-board .cell {
  cursor: default;
}

.cell--white {
  background: #fffdfa;
}

.cell--lit {
  background: #fff1c4;
}

.cell--lamp {
  background: #ffe1a1;
}

.cell--marked {
  background: #fffdfa;
  color: var(--muted);
}

.cell--dark,
.cell--clue {
  background: #283042;
  color: white;
}

.cell--ok {
  box-shadow: inset 0 0 0 4px rgba(69, 164, 96, 0.78);
}

.cell--under {
  box-shadow: inset 0 0 0 4px rgba(216, 147, 9, 0.82);
}

.cell--over {
  box-shadow: inset 0 0 0 4px rgba(196, 67, 67, 0.86);
}

.cell--conflict {
  outline: 3px solid rgba(154, 45, 45, 0.5);
}

.cell__token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cell__token--lamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
}

.bulb-emoji-supported .cell__token--lamp {
  width: auto;
  height: auto;
  background: transparent;
  box-shadow: none;
}

.bulb-emoji-supported .cell__token--lamp::before {
  content: "💡";
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.18rem;
  line-height: 1;
}

.bulb-emoji-fallback .cell__token--lamp {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffdf2, #f2b437 60%, #d88f18 100%);
  box-shadow: 0 0 0 0.28rem rgba(242, 180, 55, 0.18);
}

.cell__token--mark {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1;
}

.akari-board--inactive {
  opacity: 0.18;
  filter: blur(1px);
  pointer-events: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(23, 25, 32, 0.56);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.survey-modal {
  width: min(46rem, 100%);
  background: var(--panel-strong);
  border: 1px solid rgba(31, 34, 48, 0.16);
  border-radius: 1.5rem;
  box-shadow: 0 36px 80px rgba(31, 34, 48, 0.28);
  padding: 1.5rem;
}

.survey-modal h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.survey-modal .actions {
  justify-content: flex-end;
}

.rating-group {
  gap: 0.8rem;
}

.rating-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
}

.rating-choice {
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: #fffdf8;
  color: var(--ink);
  padding: 0.8rem 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

.rating-choice--selected {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  border-color: transparent;
}

.rating-scale__labels {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reconnect-suppressed,
#components-reconnect-modal,
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-hide,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 980px) {
  .shell__header {
    align-items: start;
    flex-direction: column;
  }

  .tutorial-hero,
  .tutorial-support,
  .tutorial-notes,
  .study-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell__content,
  .shell__header {
    width: min(100% - 1.25rem, 100%);
  }

  .panel,
  .panel--hero,
  .survey-modal {
    padding: 1.2rem;
  }

  .button,
  .rating-choice {
    width: 100%;
  }

  .rating-scale {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }
}
