:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  --bar-height: 88px;
  --menu-background: #fff;
  --purple: #46104f;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--purple); color: #080808; font-size: 20px; }
button, a, time { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid #245db6; outline-offset: -2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app, .game-screen { width: 100%; height: 100%; height: 100dvh; }
.game-screen { display: grid; grid-template-rows: var(--bar-height) minmax(0, 1fr); }
.toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 42px 46px;
  align-items: stretch;
  min-width: 0;
  position: relative;
  z-index: 10;
  padding: 0;
  border: 0;
  background: #fff;
  box-shadow: 0 2px 5px #22223812;
  user-select: none;
  white-space: nowrap;
}
.site-name { display: flex; align-items: center; overflow: hidden; padding: 0 24px; color: #303030; text-decoration: none; font-size: 27px; font-weight: 400; letter-spacing: -.5px; }
.site-logo { display: block; flex-shrink: 0; width: 150px; height: 50px; object-fit: contain; transform: translateY(-2px); }
.menubar { display: flex; align-items: stretch; align-self: stretch; gap: 24px; min-width: 0; padding: 4px 24px 0 0; }
.menu { position: relative; display: flex; }
.menu-trigger { min-width: 142px; padding: 0 24px; border: 1px solid #dddae1; border-bottom: 0; border-radius: 6px 6px 0 0; background: #f8f1e9; color: #41516b; font-size: 20px; font-weight: 400; line-height: 1; transition: background-color .12s, box-shadow .12s; }
.menu:nth-child(1) .menu-trigger { background: #eeecf9; }
.menu:nth-child(2) .menu-trigger { background: #f7edf7; }
.menu:nth-child(3) .menu-trigger { background: #f1f8ec; }
.menu:nth-child(4) .menu-trigger { background: #f8f2ec; }
.menu-trigger:hover { box-shadow: 0 -1px 5px #30304816; color: #1c293e; }
.menu-trigger[aria-expanded="true"] { position: relative; z-index: 2; border-color: #c9c6d9; background: #e8e5f6 !important; color: #171c2c; box-shadow: 0 -2px 7px #32314b1c; }
.stats { grid-column: 1 / -1; display: flex; align-items: center; gap: 48px; margin: 0; padding: 0 24px; background: #eeecf8; color: #24232c; font-size: 20px; }
.stat { display: inline-flex; align-items: baseline; gap: 5px; }
.time-stat { min-width: 120px; }
.unavailable-stat { min-width: 120px; }
time { font-variant-numeric: tabular-nums; }
.dropdown { position: absolute; z-index: 4; left: 0; top: 100%; min-width: 258px; padding: 6px; border: 1px solid #d7d4e3; border-radius: 0 0 6px 6px; background: var(--menu-background); box-shadow: 0 5px 14px #33304224; font-size: 16px; }
.dropdown button, .dropdown a { display: flex; justify-content: space-between; align-items: center; gap: 24px; width: 100%; min-height: 36px; padding: 6px 12px; border: 1px solid transparent; border-radius: 3px; background: none; color: #24232c; text-decoration: none; text-align: left; white-space: nowrap; font: inherit; }
.dropdown button:hover, .dropdown a:hover, .dropdown button:focus-visible, .dropdown a:focus-visible { border-color: #d9d5ed; background: #eeecf8; }
.dropdown kbd { font: inherit; color: #525c6a; }
.menu-separator { height: 1px; margin: 4px 8px; background: #c8c8c8; border-bottom: 1px solid white; }
.menu-caption { margin: 6px 12px; color: #616161; font-size: 14px; }
.language-menu { min-width: 200px; }
.check { opacity: 0; }
[aria-checked="true"] .check { opacity: 1; }
.menu-note { margin: 10px 12px; font-size: 16px; color: #4f4f4f; }
.game-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #46104f; }
#game-frame { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.loading-screen { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; background: radial-gradient(ellipse at center, #692d78, #46104f 70%); color: #fff6e9; pointer-events: none; }
.loading-screen p { margin: 22px 0 15px; font-size: 18px; }
.loading-tile { display: grid; place-items: center; width: 66px; height: 84px; border-radius: 5px; background: linear-gradient(125deg, #fffdef, #f6d78b); color: #a42b24; font: 54px Georgia, serif; box-shadow: -5px 6px 0 #f0b63c, -9px 10px 0 #72851c, 0 15px 30px #200a2e60; }
.loading-line { width: 132px; height: 2px; overflow: hidden; background: #ffffff24; }
.loading-line::after { content: ""; display: block; width: 50%; height: 100%; background: #f7d68b; animation: loading 1.3s ease-in-out infinite alternate; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(200%); } }
.restore-toolbar { position: absolute; top: 8px; left: 8px; z-index: 3; width: 38px; height: 32px; border: 1px solid #8c8c8c; border-radius: 3px; background: linear-gradient(#fff, #d8deef); box-shadow: 0 2px 8px #0003; font-size: 20px; }
.toolbar-is-hidden .game-screen { grid-template-rows: 0 minmax(0, 1fr); }
.toolbar-is-hidden .toolbar { visibility: hidden; }
.help-dialog { width: min(600px, calc(100vw - 32px)); padding: 18px 20px 22px; border: 1px solid #222; border-radius: 5px; background: #f0f0f0; box-shadow: 10px 10px 5px #0008; font-size: 16px; }
.help-dialog::backdrop { background: #0005; }
.dialog-title { display: flex; align-items: center; gap: 20px; margin-bottom: 10px; }
.dialog-title h2 { flex: 1; margin: 0; font-size: 20px; text-align: center; }
.dialog-close { width: 25px; height: 25px; padding: 0; border: 1px solid #aaa; border-radius: 2px; background: linear-gradient(#fff, #d8d8d8); font-size: 22px; line-height: 20px; }
.dialog-copy p { margin: 16px 0; line-height: 1.55; }
.shortcut-note { color: #626262; font-size: 14px; }
.dialog-actions { display: flex; justify-content: center; padding-top: 4px; }
.classic-button { padding: 5px 26px; border: 1px solid #808080; border-radius: 3px; background: linear-gradient(#fff, #dedede); font-size: 16px; }
.classic-button:hover { border-color: #3c7fb1; background: linear-gradient(#fff, #d9eafb); }
.notice { position: fixed; z-index: 30; bottom: 20px; left: 50%; max-width: calc(100vw - 32px); transform: translateX(-50%); padding: 10px 18px; border: 1px solid #a9a9a9; border-radius: 3px; background: #f0f0f0; box-shadow: 2px 3px 12px #0004; font-size: 16px; text-align: center; }
.noscript-note { position: absolute; bottom: 0; left: 0; right: 0; margin: 0; padding: 12px; background: #fff; font-size: 16px; text-align: center; }
@media (max-width: 1100px) {
  .site-name { padding-inline: 18px; font-size: 25px; }
  .menubar { gap: 12px; padding-right: 18px; }
  .menu-trigger { min-width: 118px; padding-inline: 18px; font-size: 18px; }
  .stats { gap: 32px; }
  .time-stat, .unavailable-stat { min-width: auto; }
}
@media (max-width: 900px) {
  .site-name { padding-inline: 14px; font-size: 23px; }
  .menubar { gap: 10px; padding-right: 14px; }
  .menu-trigger { min-width: 0; padding-inline: 16px; font-size: 16px; }
  .stats { padding-inline: 20px; gap: 28px; font-size: 16px; }
}
@media (max-width: 680px) {
  :root { --bar-height: 108px; }
  .toolbar { grid-template-columns: minmax(0, 1fr); grid-template-rows: 34px 38px 36px; }
  .site-name { padding-inline: 14px; font-size: 23px; }
  .site-logo { width: 126px; height: 42px; }
  .menubar { width: 100%; padding: 2px 10px 0; gap: 6px; }
  .menu { flex: 1 1 auto; min-width: 0; }
  .menu-trigger { flex: 1; padding-inline: 8px; font-size: 15px; }
  .stats { width: 100%; margin: 0; padding-inline: 14px; gap: 20px; font-size: 14px; }
  .dropdown { top: 100%; font-size: 16px; }
  .menu:nth-child(3) .dropdown, .menu:nth-child(4) .dropdown { right: 0; left: auto; }
  .dropdown button, .dropdown a { min-height: 40px; }
}
@media (max-width: 360px) {
  .menubar { padding-inline: 6px; gap: 4px; }
  .menu-trigger { font-size: 14px; padding-inline: 6px; }
  .stats { padding-inline: 10px; gap: 14px; }
  .other-games-menu { min-width: 210px; }
}
@media (prefers-reduced-motion: reduce) { .loading-line::after { animation: none; width: 100%; } }

.dropdown button:disabled { color: #8d8d96; cursor: default; background: transparent; border-color: transparent; }
.dropdown { max-width: calc(100vw - 16px); max-height: min(480px, calc(100dvh - 84px)); overflow: auto; overscroll-behavior: contain; transform: translateX(var(--menu-offset, 0px)); }

/* Long language list, with native labels and a bounded scroll area. */
.language-menu { max-height: min(480px, calc(100dvh - 84px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.language-menu button { direction: ltr; text-align: left; }
.toolbar[dir="rtl"] .dropdown { right: 0; left: auto; }
.toolbar[dir="rtl"] .dropdown button, .toolbar[dir="rtl"] .dropdown a { text-align: right; }
.toolbar[dir="rtl"] .language-menu button { text-align: left; }
.toolbar[dir="rtl"] .site-name { direction: ltr; }
.toolbar[dir="rtl"] time, .toolbar[dir="rtl"] #tiles-left, .toolbar[dir="rtl"] #moves-available { direction: ltr; unicode-bidi: isolate; }
@media (min-width: 681px) { .toolbar[dir="rtl"] .menubar { padding-right: 0; padding-left: 24px; } }
