:root {
  --bg: #06131b; --panel: #0a1c25; --raised: #122c37; --sunk: #031017;
  --frame: #b98327; --frame-hi: #f1d17a; --text: #eef3f2; --muted: #a7b9bb;
  --cyan: #61d4e6; --quick: #61d4e6; --strong: #f1d17a; --ultimate: #ff8a7a;
}
* { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); background: var(--bg);
  font: 400 1.0625rem/1.65 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--frame-hi); }
:focus-visible { outline: 2px solid var(--frame-hi); outline-offset: 2px; }
img { max-width: 100%; height: auto; display: block; }

.site-head { background: var(--sunk); border-bottom: 2px solid var(--frame); }
.site-head__in {
  width: min(1040px, 100%); margin: auto; padding: 10px 16px;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px 20px;
}
.site-logo { display: block; flex: none; }
.site-logo img { height: 44px; width: auto; }
.site-nav { display: flex; flex-wrap: nowrap; white-space: nowrap; gap: 2px 18px; flex: 1; font-size: .95rem; }
.site-nav a { color: var(--text); text-decoration: none; padding: 5px 0; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--frame-hi); }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; font-weight: 800; text-decoration: none;
  color: #1c1203; background: linear-gradient(#ffe89a, #dcaa3f); box-shadow: 0 4px 0 #7a5413;
}
.btn:hover { color: #1c1203; background: linear-gradient(#fff2bd, #e9bb54); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #7a5413; }

.site-menu { display: none; }
.key-btn {
  display: grid; place-items: center; min-height: 58px; padding: 8px; border-radius: 9px; text-align: center;
  font-weight: 800; color: #fff; text-decoration: none; background: linear-gradient(#5a5f69, #454952); box-shadow: 0 5px 0 #24272d;
}
.key-btn:hover, .key-btn[aria-current] { color: var(--frame-hi); }
.key-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #24272d; }
@media (max-width: 860px) {
  .site-nav, .site-play { display: none; }
  .site-head__in { justify-content: space-between; }
  .site-menu { display: block; }
  .site-menu summary {
    position: relative; z-index: 11; display: grid; place-items: center; width: 44px; height: 42px; cursor: pointer; list-style: none;
    border-radius: 9px; color: #fff; background: linear-gradient(#5a5f69, #454952); box-shadow: 0 5px 0 #24272d;
  }
  .site-menu summary::-webkit-details-marker { display: none; }
  .site-menu__bars { display: grid; gap: 4px; width: 20px; }
  .site-menu__bars i { display: block; height: 3px; border-radius: 2px; background: currentColor; transition: transform .12s; }
  .site-menu[open] summary { position: fixed; top: 10px; right: 16px; }
  .site-menu[open] .site-menu__bars i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .site-menu[open] .site-menu__bars i:nth-child(2) { opacity: 0; }
  .site-menu[open] .site-menu__bars i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .site-menu__panel {
    position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; gap: 20px; padding: 10px 16px 24px;
    overflow-y: auto; background: linear-gradient(180deg, #0a1c25, #06131b 60%, #031017);
  }
  .site-menu__panel img { height: 62px; width: auto; align-self: flex-start; }
  .site-menu__keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .site-menu__keys .key-btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .site-menu__play { text-align: center; padding: 15px; }
}
@media (max-width: 359px) {
  h2 { font-size: 1.02rem; }
}

main { width: min(800px, 100%); margin: auto; padding: 28px 16px 56px; }
.wide { width: min(1040px, 100%); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h1 { margin: .2em 0 .45em; font-size: clamp(2rem, 6vw, 3rem); font-weight: 900; font-style: italic; }
h2 { margin: 1.9em 0 .5em; font-size: clamp(1.2rem, 4vw, 1.75rem); font-weight: 800; color: var(--frame-hi); }
h3 { margin: 1.5em 0 .4em; font-size: 1.15rem; font-weight: 800; }
p, ul, ol { margin: 0 0 1em; }
li { margin-bottom: .4em; }
.lead { font-size: 1.2rem; color: var(--text); }
.muted { color: var(--muted); }
.crumbs { font-size: .9rem; color: var(--muted); margin: 0 0 8px; }

.shot { margin: 22px 0; border: 2px solid var(--frame); border-radius: 10px; overflow: hidden; background: var(--sunk); }
.shot figcaption { padding: 8px 12px; font-size: .9rem; color: var(--muted); }
.cta { margin: 30px 0; padding: 20px; background: var(--panel); border: 1px solid var(--frame); border-radius: 10px; }
.cta p { margin-bottom: .75em; }
.cta small { display: block; margin-top: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; margin: 0 0 1.25em; border: 1px solid #27454f; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
th, td { padding: 9px 12px; text-align: left; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 220px; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; background: var(--sunk); }
tbody tr:nth-child(odd) { background: var(--panel); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 18px 0; padding: 0; list-style: none; }
.card { margin: 0; padding: 16px; background: var(--panel); border: 1px solid #27454f; border-radius: 10px; }
.card img { height: 96px; width: auto; margin: 0 auto 10px; }
.card h3 { margin-top: 0; }
.card h3 a { color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: .98rem; }

.words { columns: 3 150px; column-gap: 20px; padding: 0; margin: 0 0 1em; list-style: none; }
.words--long { columns: 2 280px; }
.words li { break-inside: avoid; margin: 0 0 4px; }
.tier { display: inline-block; font-weight: 800; }
.tier--quick { color: var(--quick); }
.tier--strong { color: var(--strong); }
.tier--ultimate { color: var(--ultimate); }

.log { margin: 26px 0; padding: 0 0 8px; border-bottom: 1px solid #27454f; }
.log h2 { margin-top: 0; }
.log time { display: block; font-size: .85rem; letter-spacing: .05em; color: var(--muted); }

.keys { margin: 22px 0; padding: 14px; background: var(--sunk); border: 1px solid #27454f; border-radius: 10px; overflow-x: auto; }
.keys__row { display: flex; gap: 5px; margin-bottom: 5px; min-width: 460px; }
.keys__row--1 { padding-left: 16px; }
.keys__row--2 { padding-left: 42px; }
.key { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 6px; font-weight: 800; color: #04161d; }
.key--home { outline: 3px solid #fff; outline-offset: -3px; }
.key--space { flex: 0 0 240px; margin-left: 96px; background: var(--raised); color: var(--text); font-size: .85rem; font-weight: 600; }
.f1 { background: #ff9d8f; } .f2 { background: #ffc27a; } .f3 { background: #f1d17a; } .f4 { background: #9fe0a0; }
.f5 { background: #7fdcea; } .f6 { background: #9dbcf5; } .f7 { background: #c9a9f5; } .f8 { background: #f0a6dc; }
.keys__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; min-width: 0; font-size: .88rem; color: var(--muted); }
.keys__legend span { display: inline-flex; align-items: center; gap: 6px; }
.keys__legend i { width: 14px; height: 14px; border-radius: 3px; }

.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 22px 0; padding: 18px; background: var(--panel); border: 1px solid var(--frame); border-radius: 10px; }
.calc label { display: grid; gap: 6px; align-content: end; font-size: .92rem; color: var(--muted); }
.calc input { width: 100%; padding: 9px 10px; font: inherit; color: var(--text); background: var(--sunk); border: 1px solid #3a5c67; border-radius: 6px; }
.calc__out { grid-column: 1 / -1; font-size: 1.05rem; }
.calc__out b { font-size: 2.3rem; font-weight: 900; color: var(--frame-hi); }
.calc__out span { display: block; color: var(--muted); }

.key-btn--sm { display: inline-grid; min-height: 40px; padding: 6px 14px; font-size: .92rem; border: 0; cursor: pointer; font-family: inherit; box-shadow: 0 4px 0 #24272d; }
.key-btn--sm[aria-pressed="true"] { color: #1c1203; background: linear-gradient(#ffe89a, #dcaa3f); box-shadow: 0 4px 0 #7a5413; }
.tt { margin: 22px 0 8px; padding: 18px; background: var(--panel); border: 2px solid var(--frame); border-radius: 12px; }
.tt__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; }
.tt__lengths { display: flex; gap: 8px; }
.tt__stats { display: flex; gap: 22px; margin: 0; }
.tt__stats div { display: flex; flex-direction: column-reverse; align-items: flex-end; }
.tt__stats dt { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tt__stats dd { margin: 0; font-size: 1.6rem; line-height: 1.1; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--frame-hi); }
.tt__passage { margin: 0 0 14px; padding: 18px; min-height: 150px; font-size: clamp(1.1rem, 2.6vw, 1.45rem); line-height: 1.7; color: #b7c7c9; background: var(--sunk); border-radius: 8px; overflow-wrap: anywhere; }
.tt__passage .ok { color: var(--frame-hi); }
.tt__passage .bad { color: #fff; background: #c8413a; border-radius: 2px; }
.tt__passage .next { color: var(--text); box-shadow: inset 0 -3px 0 var(--cyan); }
.tt__source { margin: -6px 0 14px; font-size: .9rem; color: var(--muted); }
.tt__source a { font-style: italic; }
.tt__input { display: block; width: 100%; padding: 14px 16px; font: 500 1.15rem/1.5 inherit; font-family: inherit; color: var(--text); background: var(--sunk); border: 2px solid #3a5c67; border-radius: 8px; resize: vertical; }
.tt__input:focus { outline: 0; border-color: var(--cyan); }
.tt__actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.tt__result { margin-top: 18px; padding-top: 16px; border-top: 1px solid #27454f; }
.tt__result[hidden] { display: none; }
.tt__score { margin: 0; font-size: 1.3rem; font-weight: 800; }
.tt__score b { font-size: 3.2rem; font-weight: 900; font-style: italic; color: var(--frame-hi); }
.tt__next { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }

.site-foot { background: var(--sunk); border-top: 2px solid var(--frame); }
.site-foot__in { width: min(1040px, 100%); margin: auto; padding: 22px 16px 30px; font-size: .92rem; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 10px; }
