.puzzle-page {
  --p-ink: #172437;
  --p-muted: #515f6c;
  --p-rule: #d9dee1;
  --p-paper: #fffefb;
  background: #1b2b47;
}
.puzzle-page [hidden] { display: none; }
.puzzle-header { background: #fbf8f1; border-bottom: 1px solid #dad6ce; }
.puzzle-header .shell { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.puzzle-home { color: #3f454c; font-size: .87rem; font-weight: 630; text-decoration: none; }
.puzzle-home span { margin-left: .1em; }
.puzzle-home:hover, .puzzle-footnote a:hover { text-decoration: underline; }
.puzzle-main {
  min-height: calc(100svh - 64px);
  color: var(--p-ink);
  background: linear-gradient(100deg, #14223bf2 2%, #1b304cd4 46%, #2b344a79 100%), url('/assets/img/club-dawn.webp') center 58% / cover;
}
.puzzle-layout {
  display: grid;
  grid-template-columns: minmax(245px, .82fr) minmax(0, 1.18fr);
  align-items: start;
  gap: clamp(42px, 7vw, 104px);
  max-width: 1080px;
  padding-block: clamp(48px, 7.2vh, 94px);
}
.puzzle-menu { padding-top: clamp(10px, 2.8vw, 40px); color: #f9fafc; }
.puzzle-menu h1 { color: inherit; font-size: clamp(3rem, 5.6vw, 5.35rem); font-weight: 730; line-height: 1.04; letter-spacing: -.08em; }
.puzzle-intro { margin-top: 24px; color: #e1e6ed; font-size: clamp(1rem, 1.4vw, 1.18rem); line-height: 1.64; letter-spacing: -.025em; }
.puzzle-studio-entry {
  display: flex; align-items: center; gap: 12px; max-width: 325px;
  margin-top: 22px; padding: 11px 14px; border-radius: 8px;
  background: #f1e9d8; color: #263733; text-decoration: none;
}
.puzzle-studio-entry:hover { background: #fff6e4; }
.puzzle-studio-entry:focus-visible { outline-color: #ffdfae; }
.puzzle-studio-entry strong, .puzzle-studio-entry small { display: block; }
.puzzle-studio-entry strong { font-size: 1rem; letter-spacing: -.035em; }
.puzzle-studio-entry small { color: #555b50; font-size: .82rem; }
.puzzle-studio-entry > span:last-child { margin-left: auto; }
.puzzle-studio-icon { flex: 0 0 29px; height: 29px; position: relative; }
.puzzle-studio-icon::before, .puzzle-studio-icon::after { content: ""; position: absolute; }
.puzzle-studio-icon::before {
  width: 22px; height: 19px; right: 0; top: 0;
  border: 5px solid #9b5b37; border-bottom: 0; border-radius: 12px 12px 0 0;
}
.puzzle-studio-icon::after {
  width: 18px; height: 14px; left: 0; bottom: 0; border-radius: 3px;
  background: #656f51; transform: rotate(-12deg);
}
.puzzle-types { display: grid; margin-top: clamp(22px, 3.5vh, 36px); max-width: 325px; }
.puzzle-types a {
  scroll-margin-top: 40svh;
  position: relative;
  display: grid;
  gap: 2px;
  padding: 16px 36px 16px 5px;
  color: #f8f7f3;
  text-decoration: none;
  border-top: 1px solid #ffffff46;
}
.puzzle-types a:last-child { border-bottom: 1px solid #ffffff46; }
.puzzle-types a strong { font-size: 1.14rem; letter-spacing: -.02em; }
.puzzle-types a span { color: #ced6e1; font-size: .87rem; }
.puzzle-types a::after { content: '→'; position: absolute; right: 5px; top: 20px; opacity: 0; }
.puzzle-types a:hover::after, .puzzle-types a[aria-current]::after { opacity: 1; }
.puzzle-types a[aria-current] strong, .puzzle-types a[aria-current]::after { color: #ffdfae; }
.puzzle-types a:focus-visible, .puzzle-footnote a:focus-visible { outline-color: #ffdba2; }
.puzzle-table { min-width: 0; }
.puzzle-sheet {
  padding: clamp(25px, 3.3vw, 46px);
  border-radius: 10px;
  background: var(--p-paper);
  box-shadow: 0 24px 70px #0c172f40, 0 1px 2px #12233419;
}
.puzzle-edition {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--p-rule);
  color: var(--p-muted);
  font-size: .79rem;
  letter-spacing: .02em;
  font-weight: 620;
}
.puzzle-sheet h2 { color: var(--p-ink); font-size: clamp(2rem, 3.25vw, 3rem); line-height: 1.15; letter-spacing: -.067em; }
.puzzle-sheet h2 + p { margin-top: 12px; }
.puzzle-prompt { color: var(--p-muted); font-size: 1rem; line-height: 1.65; letter-spacing: -.015em; }
.puzzle-clues {
  display: grid; gap: 7px; padding: 13px 14px 13px 30px; margin: 17px 0 0;
  border-left: 2px solid #a8b8c7; background: #f0f3f4;
  color: #364557; font-size: .93rem; line-height: 1.52;
  font-variant-numeric: tabular-nums;
}
.puzzle-clues li::marker { color: #8494a5; font-size: .8em; }
.puzzle-history { margin-top: 15px; color: #364557; }
.puzzle-history h3 { color: inherit; font-size: .84rem; letter-spacing: -.02em; }
.puzzle-history ul { display: grid; gap: 4px; padding: 0; margin: 6px 0; list-style: none; font-size: .88rem; font-variant-numeric: tabular-nums; }
.puzzle-expression, .sample-expression {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  min-height: 104px; padding: 15px 6px; gap: clamp(2px, .5vw, 7px);
  margin: 22px 0 20px; border-block: 1px solid var(--p-rule);
  font-family: var(--font); font-size: clamp(1.3rem, 2.4vw, 2rem); font-weight: 620;
  font-variant-numeric: tabular-nums; line-height: 1.35; white-space: pre;
}
.puzzle-expression .literal { color: #495461; }
.slot {
  display: grid; place-items: center; flex: 0 0 auto;
  width: clamp(39px, 4.1vw, 55px); height: clamp(47px, 4.8vw, 65px);
  border: 1.5px dashed #a9b3bf; border-radius: 7px;
  background: #f3f5f6; color: var(--p-ink); padding: 0;
  font: inherit; font-weight: 690; line-height: 1; cursor: pointer;
}
.slot:disabled { opacity: 1; cursor: default; }
.slot:empty::before { content: ''; width: 13px; height: 2px; background: #a6b3bf; border-radius: 2px; }
.slot.filled { border: 1px solid #68798c; background: #eaf0f5; }
.puzzle-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(5px, 1vw, 10px); }
.puzzle-chip {
  display: grid; place-items: center; min-width: 44px; height: 50px; padding: 0 9px;
  border: 1px solid #b8c3cc; box-shadow: 0 2px 0 #cad1d8;
  border-radius: 7px; background: #fff; color: #203147;
  font-family: var(--font); font-size: 1.3rem; font-weight: 640;
  line-height: 1; font-variant-numeric: tabular-nums; cursor: pointer;
}
.puzzle-chip[aria-pressed="true"] { color: #fff; background: #2a3b50; border-color: #2a3b50; box-shadow: 0 2px 0 #172636; }
.puzzle-chip:disabled { cursor: default; opacity: 1; }
.puzzle-tools { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 18px; }
.puzzle-tools summary, .puzzle-reset, .puzzle-sheet[data-fallback] summary {
  width: fit-content; padding: 7px 0; min-height: 38px;
  background: none; border: 0; border-radius: 2px; cursor: pointer;
  color: #40556c; font-size: .88rem; font-weight: 600;
}
.puzzle-tools summary:hover, .puzzle-reset:hover:enabled { text-decoration: underline; }
.puzzle-hint p { margin: 3px 0 8px; color: var(--p-muted); font-size: .92rem; }
.puzzle-reset { flex-shrink: 0; text-underline-offset: 3px; }
.puzzle-reset:disabled { color: #707b87; cursor: default; }
.puzzle-feedback { margin: 8px 0; min-height: 1.4em; color: #364d64; font-size: .91rem; font-weight: 600; }
.puzzle-sheet[data-solved] .slot.filled { color: #1c463b; background: #e7f0e9; border-color: #78978a; }
.puzzle-sheet[data-solved] .puzzle-feedback { color: #245648; }
.puzzle-action {
  display: block; width: 100%; min-height: 48px; border: 0; border-radius: 7px;
  background: #1c2a3f; color: #fff; cursor: pointer;
  font-size: 1rem; font-weight: 670; letter-spacing: -.02em;
}
.puzzle-action:hover:enabled { background: #324967; }
.puzzle-action:disabled { background: #e1e6e9; color: #53616c; cursor: default; }
.puzzle-footnote { margin: 17px 2px 0; color: #fff6eb; line-height: 1.65; font-size: .85rem; }
.puzzle-footnote a { display: inline-block; margin-left: 4px; text-underline-offset: .25em; font-weight: 570; }
.sample-note { margin-top: 14px; font-size: .9rem; color: var(--p-muted); }
@media (min-width: 741px) and (max-width: 930px) {
  .puzzle-layout { grid-template-columns: minmax(188px, .68fr) minmax(0, 1.32fr); gap: 35px; }
}
@media (max-width: 740px) {
  .puzzle-header .shell { min-height: 54px; }
  .puzzle-main { min-height: calc(100svh - 54px); background-position: center, 48% center; }
  .puzzle-layout { display: block; max-width: 560px; padding: 26px 0 36px; }
  .puzzle-menu { padding-top: 0; }
  .puzzle-menu h1 { font-size: clamp(2.3rem, 7.5vw, 3.2rem); }
  .puzzle-intro { font-size: .93rem; margin-top: 10px; }
  .puzzle-intro br { display: none; }
  .puzzle-studio-entry { max-width: none; margin-top: 13px; padding: 8px 12px; }
  .puzzle-types { grid-template-columns: repeat(3, 1fr); gap: 2px; max-width: none; margin: 18px 0 13px; }
  .puzzle-types a, .puzzle-types a:last-child { display: grid; place-items: center; padding: 8px 2px; min-height: 44px; border: 0; border-bottom: 1px solid #ffffff54; }
  .puzzle-types a[aria-current] { border-bottom: 3px solid #ffdc9d; padding-bottom: 6px; }
  .puzzle-types a strong { font-size: .94rem; }
  .puzzle-types a span, .puzzle-types a::after { display: none; }
  .puzzle-sheet { padding: clamp(16px, 4.7vw, 25px); }
  .puzzle-edition { margin-bottom: 14px; padding-bottom: 10px; }
  .puzzle-sheet h2 { font-size: 1.9rem; }
  .puzzle-expression { min-height: 80px; margin: 16px 0; }
  .puzzle-hand { gap: 6px; }
  .puzzle-tools { margin-top: 12px; }
  .puzzle-table:has([data-game][hidden]) { margin-top: 18px; }
}
@media (max-width: 365px) {
  .puzzle-layout { width: calc(100% - 24px); }
  .puzzle-hand { gap: 5px; }
  .puzzle-chip { min-width: 44px; height: 46px; }
  .puzzle-expression { gap: 2px; font-size: 1.13rem; }
  .puzzle-prompt, .puzzle-clues { font-size: .9rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .puzzle-chip, .slot { transition: background-color .14s, color .14s, transform .14s; }
  .puzzle-chip:hover:enabled, .slot:hover:enabled { transform: translateY(-2px); }
}
@media (prefers-color-scheme: dark) {
  .puzzle-page { color-scheme: dark; --p-paper: #1a2430; --p-ink: #f3f5f6; --p-muted: #c4cdd6; --p-rule: #465363; }
  .puzzle-header { background: #17202c; border-color: #465363; }
  .puzzle-header a { color: #edf1f4; }
  .puzzle-clues { background: #263340; border-color: #7c92aa; color: #e1e7ed; }
  .puzzle-clues li::marker { color: #b6c6d8; }
  .puzzle-expression .literal, .puzzle-history { color: #d9e0e7; }
  .slot { background: #222f3d; border-color: #788899; }
  .slot.filled { background: #35495b; border-color: #a7bbce; }
  .puzzle-chip { background: #293747; color: #f1f4f6; border-color: #738397; box-shadow: 0 2px 0 #111a26; }
  .puzzle-chip[aria-pressed="true"] { background: #dbe9f3; color: #152438; border-color: #dbe9f3; }
  .puzzle-tools summary, .puzzle-reset, .puzzle-sheet[data-fallback] summary, .puzzle-feedback { color: #cad8e9; }
  .puzzle-reset:disabled { color: #a2aeb9; }
  .puzzle-action { color: #162337; background: #e2eaf1; }
  .puzzle-action:hover:enabled { background: #fff; }
  .puzzle-action:disabled { color: #b7c1cd; background: #34414e; }
  .puzzle-sheet[data-solved] .slot.filled { color: #e5f6ec; background: #344a42; border-color: #91b7a8; }
  .puzzle-sheet[data-solved] .puzzle-feedback { color: #b0dbc6; }
  .puzzle-page :focus-visible { outline-color: #f8ca8b; }
}
