:root {
  color-scheme: light;
  --ink: #121212;
  --muted: #727272;
  --line: #d8d8d8;
  --soft: #f4f4f4;
  --yellow: #f7da21;
  --yellow-deep: #e6c810;
  --green: #477a54;
  --panel: #ffffff;
  --footer: #fafafa;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: #fff; letter-spacing: 0; }
.page-game, .page-guide { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
button { color: inherit; font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #2b6cb0; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; background: #fff; color: #000; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.site-header { flex: none; height: 76px; border-top: 4px solid var(--yellow); border-bottom: 1px solid var(--line); background: #fff; }
.header-inner { position: relative; width: min(1120px, 100%); height: 100%; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; }
.brand-block { min-width: 0; display: flex; align-items: baseline; gap: 14px; }
.brand-block h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 31px; line-height: 1; letter-spacing: 0; white-space: nowrap; }
.header-date { color: #555; font-size: 14px; white-space: nowrap; }
.game-nav { position: relative; display: flex; align-items: center; gap: 18px; }
.nav-button, .icon-button { border: 0; background: transparent; cursor: pointer; }
.nav-button { padding: 9px 0 7px; font-size: 14px; font-weight: 700; border-bottom: 2px solid transparent; }
.nav-button:hover { border-color: var(--yellow-deep); }
.icon-button { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; font-size: 22px; }
.game-menu { position: absolute; z-index: 20; top: 48px; right: 0; width: 190px; padding: 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff; box-shadow: 0 5px 18px rgb(0 0 0 / 14%); }
.game-menu button { width: 100%; padding: 11px 12px; border: 0; border-radius: 3px; background: transparent; text-align: left; cursor: pointer; }
.game-menu button:hover { background: var(--soft); }
.mobile-menu-item { display: none; }
.game-nav button:disabled { color: #aaa; cursor: wait; border-color: transparent; }
.app-status { width: min(520px, calc(100% - 32px)); min-height: 170px; margin: 56px auto -226px; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; position: relative; z-index: 5; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 8px 30px rgb(0 0 0 / 9%); text-align: center; }
.app-status strong { font-family: Georgia, "Times New Roman", serif; font-size: 25px; }
.app-status span { color: var(--muted); font-size: 14px; line-height: 1.4; }
.app-status .primary-button { min-height: 42px; margin-top: 10px; }
.status-spinner { width: 28px; height: 28px; margin-bottom: 5px; border: 3px solid #ddd; border-top-color: var(--yellow-deep); border-radius: 50%; animation: spin 800ms linear infinite; }
.app-status:has(.primary-button:not([hidden])) .status-spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.game-layout { width: min(1080px, 100%); min-height: 0; margin: 0 auto; padding: 48px 32px 58px; display: grid; grid-template-columns: minmax(410px, 1.05fr) minmax(340px, .85fr); align-content: start; gap: 80px; flex: 1; }
.game-layout.is-loading { opacity: .16; pointer-events: none; user-select: none; }
.play-panel { min-width: 0; display: flex; flex-direction: column; align-items: center; }
.progress-button { width: 100%; max-width: 480px; min-height: 48px; padding: 0; display: grid; grid-template-columns: 95px 1fr 38px; align-items: center; gap: 12px; border: 0; background: transparent; cursor: pointer; }
.rank-name { font-size: 14px; font-weight: 700; text-align: left; }
.score-value { font-size: 15px; font-weight: 700; }
.progress-track { position: relative; height: 4px; background: #d5d5d5; }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--yellow); transition: width 320ms ease; }
.progress-dots { position: absolute; inset: 0; }
.progress-dots i { position: absolute; top: 50%; width: 8px; height: 8px; border: 2px solid #aaa; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); }
.progress-dots i.passed { border-color: var(--yellow-deep); background: var(--yellow); }
.feedback { height: 32px; margin-top: 16px; padding: 7px 14px; border-radius: 3px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; opacity: 0; transform: translateY(5px); transition: 150ms ease; }
.feedback.visible { opacity: 1; transform: none; }
.feedback.success { background: var(--green); }
.word-input { width: 100%; height: 54px; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 38px; font-weight: 800; text-transform: uppercase; }
.word-input span { color: var(--ink); }
.word-input .center-letter { color: #d5ac00; }
.word-input .input-placeholder { color: #aaa; font-size: 28px; font-weight: 400; }
.caret { width: 2px; height: 33px; margin-left: 3px; background: var(--yellow-deep); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.controls-stage { width: 256px; height: 343px; margin: 7px 0 0; }
.controls-group { position: relative; width: 256px; height: 343px; transform-origin: top left; }
.hive { position: relative; width: 256px; height: 266px; }
.hex { position: absolute; width: 96px; height: 90px; padding: 0; border: 0; background: #dedede; clip-path: polygon(25% 2%, 75% 2%, 100% 50%, 75% 98%, 25% 98%, 0 50%); cursor: pointer; font-size: 27px; font-weight: 800; line-height: 1; transition: transform 100ms ease, background 100ms ease; }
.hex:hover { background: #dcdcdc; }
.hex-top { left: 80px; top: 0; }
.hex-upper-left { left: 0; top: 45px; }
.hex-upper-right { left: 160px; top: 45px; }
.hex-center { left: 80px; top: 90px; z-index: 2; background: var(--yellow); }
.hex-center:hover { background: var(--yellow-deep); }
.hex-lower-left { left: 0; top: 135px; }
.hex-lower-right { left: 160px; top: 135px; }
.hex-bottom { left: 80px; top: 180px; }
.hex.pressed { animation: press 180ms ease; }
@keyframes press { 50% { transform: scale(.88); } }
.action-row { position: absolute; bottom: 0; left: 0; width: 256px; height: 49px; display: flex; align-items: center; justify-content: center; gap: 16px; }
.action-button, .round-button, .primary-button { border: 1px solid #aaa; background: #fff; cursor: pointer; font-weight: 700; }
.action-button, .round-button { border-color: #d3d3d3; font-weight: 400; }
.action-button { flex: 0 0 88px; width: 88px; height: 49px; padding: 0 16px; border-radius: 25px; font-size: 16px; }
.round-button { flex: 0 0 48px; width: 48px; height: 48px; padding: 12px; border-radius: 50%; }
.round-button svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-button:hover, .round-button:hover { background: var(--soft); }
.action-button:active, .round-button:active { transform: scale(.96); }

.words-panel { align-self: start; min-width: 0; border: 1px solid #cecece; border-radius: 4px; overflow: hidden; background: var(--panel); box-shadow: 0 8px 24px rgb(0 0 0 / 5%); }
.words-summary { width: 100%; min-height: 62px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 16px; font-weight: 700; text-align: left; }
.chevron { font-size: 18px; transition: transform 180ms ease; }
.words-summary[aria-expanded="false"] .chevron { transform: rotate(180deg); }
.words-body { max-height: 520px; padding: 6px 20px 20px; overflow: auto; transition: max-height 180ms ease, padding 180ms ease; }
.words-body.collapsed { max-height: 0; padding-top: 0; padding-bottom: 0; }
.empty-words { min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-words strong { color: var(--ink); font-size: 15px; }
.empty-words span { max-width: 220px; font-size: 13px; line-height: 1.4; }
.word-list { columns: 2; column-gap: 24px; margin: 0; padding: 0; list-style: none; }
.word-list li { min-width: 0; padding: 10px 0; display: flex; align-items: center; gap: 6px; break-inside: avoid; border-bottom: 1px solid #ececec; font-size: 14px; text-transform: capitalize; }
.word-list li span { min-width: 0; overflow-wrap: anywhere; }
.word-list li strong { padding: 2px 5px; border-radius: 3px; background: var(--yellow); font-size: 9px; text-transform: uppercase; }

.modal { width: min(520px, calc(100% - 32px)); max-height: min(760px, calc(100vh - 32px)); padding: 0; border: 0; border-radius: 6px; background: #fff; box-shadow: 0 18px 60px rgb(0 0 0 / 28%); }
.modal::backdrop { background: rgb(255 255 255 / 86%); }
.modal-content { position: relative; padding: 38px 42px; overflow: auto; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal h2 { margin: 0 0 14px; font-family: Georgia, "Times New Roman", serif; font-size: 32px; letter-spacing: 0; }
.modal h3 { margin: 24px 0 12px; font-size: 16px; }
.dialog-lede { margin: 0 0 20px; color: #444; font-size: 17px; line-height: 1.45; }
.modal hr { margin: 24px 0; border: 0; border-top: 1px solid var(--line); }
.welcome-modal { width: min(680px, calc(100% - 32px)); }
.welcome-content { min-height: 530px; padding: 65px 24px 45px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.welcome-content h2 { margin: 20px 0 10px; font-size: 48px; }
.welcome-lede { max-width: 440px; margin: 0 0 32px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; line-height: 1.25; }
.welcome-date { margin: 30px 0 0; color: #555; font-size: 14px; }
.welcome-editor { min-height: 18px; margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.bee-mark { position: relative; width: 88px; height: 70px; }
.bee-mark span { position: absolute; width: 48px; height: 44px; clip-path: polygon(25% 3%,75% 3%,100% 50%,75% 97%,25% 97%,0 50%); background: var(--yellow); }
.bee-mark span:nth-child(1) { left: 20px; top: 0; }
.bee-mark span:nth-child(2) { left: 0; top: 28px; background: var(--ink); }
.bee-mark span:nth-child(3) { right: 0; top: 28px; }
.primary-button { min-width: 130px; min-height: 48px; padding: 0 24px; border: 0; border-radius: 24px; background: var(--ink); color: #fff; }
.primary-button:hover { background: #333; }
.rules-list { margin: 0; padding-left: 22px; line-height: 1.6; }
.rules-list li + li { margin-top: 5px; }
.ranks-list { margin: 0; padding: 0; list-style: none; }
.ranks-list li { padding: 9px 12px; display: flex; justify-content: space-between; border-bottom: 1px solid #eee; color: #777; }
.ranks-list li.reached { color: var(--ink); background: #fffbe2; }
.hint-totals, .stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.hint-totals div, .stats-grid div { min-width: 0; padding: 16px 8px; display: flex; flex-direction: column; gap: 4px; background: #fff; text-align: center; }
.hint-totals strong, .stats-grid strong { font-size: 24px; }
.hint-totals span, .stats-grid span { color: var(--muted); font-size: 12px; }
.stats-grid { grid-template-columns: repeat(4, 1fr); }
.initial-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.initial-grid div { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; }
.initial-grid span { color: var(--muted); font-size: 12px; }
.badges-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge { min-height: 120px; padding: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 6px; text-align: center; }
.badge > span { color: var(--yellow-deep); font-size: 34px; }
.badge small { margin-top: 4px; color: var(--muted); }
.muted { color: var(--muted); }
.share-button { width: 100%; margin-top: 24px; }
.archive-form { display: grid; gap: 10px; }
.archive-form label { font-size: 14px; font-weight: 700; }
.archive-form input { width: 100%; height: 48px; padding: 0 12px; border: 1px solid #999; border-radius: 4px; background: #fff; color: var(--ink); font: inherit; }
.archive-form .primary-button { width: 100%; margin-top: 6px; }
.archive-range { margin: 16px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.toast { position: fixed; z-index: 100; bottom: 24px; left: 50%; padding: 11px 16px; border-radius: 4px; background: var(--ink); color: #fff; opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: 150ms ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.site-footer { flex: none; border-top: 1px solid var(--line); background: var(--footer); }
.footer-inner { width: min(1080px, 100%); margin: 0 auto; padding: 27px 28px 30px; display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--muted); font-size: 12px; line-height: 1.55; text-align: center; }
.footer-inner p { max-width: 760px; margin: 0; }
.footer-inner p strong { color: #4a4a4a; }
.footer-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 30px; }
.footer-nav a { padding: 2px 0 5px; border-bottom: 2px solid transparent; color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none; }
.footer-nav a:hover, .footer-nav a[aria-current="page"] { border-bottom-color: var(--yellow-deep); }

.content-header { flex: none; height: 68px; border-top: 4px solid var(--yellow); border-bottom: 1px solid var(--line); background: #fff; }
.content-header-inner { width: min(1120px, 100%); height: 100%; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.content-brand { color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 700; text-decoration: none; }
.content-nav { padding: 5px 0; border-bottom: 2px solid var(--yellow-deep); color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none; }
.guide-main { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 80px; flex: 1; }
.guide-main h1 { max-width: 680px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 46px; line-height: 1.1; letter-spacing: 0; }
.guide-main h1::after { width: 56px; height: 5px; margin: 24px 0 20px; display: block; background: var(--yellow); content: ""; }
.guide-lede { margin: 0 0 44px; color: #444; font-size: 20px; line-height: 1.6; }
.guide-main h2 { margin: 46px 0 14px; font-family: Georgia, "Times New Roman", serif; font-size: 28px; line-height: 1.2; letter-spacing: 0; }
.guide-main h2::before { width: 30px; height: 3px; margin-bottom: 12px; display: block; background: var(--yellow); content: ""; }
.guide-main h3 { margin: 28px 0 8px; padding-top: 20px; border-top: 1px solid #e8e8e8; font-size: 18px; letter-spacing: 0; }
.guide-main p, .guide-main li { font-size: 16px; line-height: 1.7; }
.guide-main ul, .guide-main ol { padding-left: 24px; }
.guide-main li + li { margin-top: 7px; }
.score-table { width: 100%; margin: 22px 0 10px; border-top: 3px solid var(--yellow); border-collapse: collapse; font-size: 15px; }
.score-table th, .score-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; }
.score-table th { background: #f7f7f5; }
.not-found-main { min-height: calc(100vh - 64px); display: grid; place-content: center; padding: 30px; text-align: center; }
.not-found-main h1 { margin: 0 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: 48px; letter-spacing: 0; }
.not-found-main p { margin: 0 0 24px; color: var(--muted); }
.not-found-main a { color: var(--ink); font-weight: 700; text-underline-offset: 3px; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .site-header { height: 64px; }
  .header-inner { padding: 0 14px; }
  .brand-block h1 { font-size: 24px; }
  .header-date { display: none; }
  .game-nav { gap: 10px; }
  .game-nav .nav-button { font-size: 12px; }
  .archive-button { display: none; }
  .mobile-menu-item { display: block; }
  .game-layout { min-height: 0; padding: 22px 14px 34px; display: flex; flex-direction: column; gap: 22px; }
  .play-panel { width: 100%; }
  .progress-button { max-width: 440px; }
  .feedback { margin-top: 8px; }
  .word-input { height: 48px; }
  .words-panel { width: 100%; order: -1; }
  .words-summary { min-height: 50px; padding: 0 15px; }
  .words-body { max-height: 190px; }
  .empty-words { min-height: 90px; }
  .modal-content { padding: 34px 24px; }
  .welcome-content { min-height: 470px; padding: 48px 20px 36px; }
  .welcome-content h2 { font-size: 42px; }
  .welcome-lede { font-size: 22px; }
  .footer-inner { padding: 24px 18px 27px; gap: 15px; }
  .footer-nav { gap: 8px 20px; }
  .content-header { height: 64px; }
  .content-header-inner { padding: 0 18px; }
  .content-brand { font-size: 22px; }
  .content-nav { font-size: 13px; }
  .guide-main { width: min(100% - 32px, 760px); padding: 42px 0 58px; }
  .guide-main h1 { font-size: 36px; }
  .guide-main h1::after { margin-top: 20px; }
  .guide-lede { margin-bottom: 36px; font-size: 18px; }
  .guide-main h2 { margin-top: 38px; font-size: 26px; }
}

@media (max-width: 440px) {
  .game-nav { gap: 8px; }
  .brand-block h1 { font-size: 20px; }
  .game-nav { gap: 4px; }
  .game-nav .nav-button { font-size: 11px; }
  .game-nav .nav-button:nth-of-type(2) { display: none; }
  .game-layout { padding-inline: 10px; }
  .word-input { font-size: 32px; }
  .progress-button { grid-template-columns: 82px 1fr 30px; gap: 8px; }
  .word-list { columns: 1; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .initial-grid { grid-template-columns: repeat(5, 1fr); }
  .content-header-inner { padding-inline: 14px; }
  .content-brand { font-size: 20px; }
  .content-nav { max-width: 108px; text-align: right; }
  .footer-nav { column-gap: 16px; }
}

@media (max-width: 287px) {
  .controls-stage { width: 224px; height: 300px; }
  .controls-group { transform: scale(.875); }
}

@media (max-width: 255px) {
  .controls-stage { width: 192px; height: 257px; }
  .controls-group { transform: scale(.75); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
