:root {
  --paper: #f7f6f2;
  --paper-deep: #efece4;
  --ink: #191a18;
  --muted: #5e605a;
  --line: #d7d7cf;
  --accent: #666952;
  --accent-light: #b9bea5;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Arial, Helvetica, sans-serif;
  --nepali: 'Noto Sans Devanagari', 'Nirmala UI', Mangal, 'Kohinoor Devanagari', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--paper); }
a { color: inherit; text-underline-offset: 4px; }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #193e35; outline-offset: 4px; }

.wrap {
  width: min(1080px, calc(100% - clamp(40px, 7vw, 96px)));
  margin-inline: auto;
}

.skip {
  position: absolute;
  top: -100px;
  left: 15px;
  z-index: 10;
  padding: 15px;
  background: var(--ink);
  color: #fff;
}
.skip:focus { top: 10px; }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 112px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-block; flex-shrink: 0; }
.brand img { display: block; width: 128px; height: auto; transition: opacity .2s ease; }
.brand:hover img { opacity: .72; }
.header-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

main { flex: 1; }

.screen { padding-block: clamp(36px, 5vw, 64px); }

/* Intro */
.eyebrow {
  margin: 0 0 20px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 clamp(30px, 4vw, 52px);
  font: 400 clamp(48px, 6.2vw, 84px)/1.04 var(--serif);
  letter-spacing: -3px;
}
h1 em { font-weight: 400; font-style: italic; color: var(--accent); }
h1:focus, h2:focus { outline: none; }

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}
.lede {
  max-width: 46ch;
  margin: 0 0 34px;
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.7;
}

.setup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 470px;
}
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.stepper {
  display: flex;
  align-items: stretch;
  height: 52px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.stepper button {
  width: 46px;
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease;
}
.stepper button:hover:not(:disabled) { background: var(--paper-deep); }
.stepper button:disabled { opacity: .28; cursor: default; }
.stepper output {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  font-size: 17px;
  font-weight: 600;
}
.select-wrap { position: relative; }
.select-wrap::after {
  content: '↓';
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
select {
  width: 100%;
  height: 52px;
  padding: 0 38px 0 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  font-size: 14px;
  cursor: pointer;
  appearance: none;
}
select:hover { background: var(--paper-deep); }

.names {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}
.names legend {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  margin-bottom: 8px;
}
.names legend span {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .8px;
  text-transform: none;
}
.name-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 470px;
}
.name-grid input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  font-size: 14px;
}
.name-grid input:hover { background: var(--paper-deep); }
.name-grid input::placeholder { color: #9a9b93; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  min-height: 52px;
  padding: 14px 20px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease, gap .25s ease, transform .15s ease, opacity .2s ease;
}
.button:hover:not(:disabled) { background: #3c4339; gap: 44px; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .42; cursor: default; }
.button span { font-size: 18px; }
.button.ghost { background: transparent; color: var(--ink); }
.button.ghost:hover:not(:disabled) { background: #eceae3; }
.start { margin-top: 30px; min-width: 260px; }

.how { border-top: 1px solid var(--ink); padding-top: 18px; }
.how .eyebrow { margin: 0; }
.how ol { margin: 6px 0 0; padding: 0; list-style: none; }
.how li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.how li:first-child { border-top: 0; }
.how li span {
  color: var(--accent);
  font: 11px/1.7 monospace;
  padding-top: 2px;
}
.how li p { margin: 0; }

/* Game */
.game { max-width: 720px; }
.game-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 22px;
  margin-bottom: 18px;
}
.game-bar .eyebrow { margin: 0; }
.dots { display: flex; gap: 7px; }
.dots i {
  display: block;
  width: 7px;
  height: 7px;
  border: 1px solid #b7b8ae;
  border-radius: 50%;
}
.dots i.done { background: var(--ink); border-color: var(--ink); }
.dots i.current { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(102, 105, 82, .16); }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(60vh, 500px);
  padding: clamp(30px, 5vw, 56px) clamp(20px, 5vw, 54px);
  border: 1px solid var(--ink);
  background: var(--paper-deep);
  text-align: center;
  overflow: hidden;
}
.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--accent);
  opacity: .75;
  pointer-events: none;
}
.card::before { top: 13px; left: 13px; border-top: 1px solid; border-left: 1px solid; }
.card::after { right: 13px; bottom: 13px; border-right: 1px solid; border-bottom: 1px solid; }
.card--word { background: var(--paper); }

.card-tag {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.card-title {
  margin: 0 0 14px;
  font: 400 clamp(30px, 4.6vw, 42px)/1.15 var(--serif);
  letter-spacing: -1.2px;
  overflow-wrap: break-word;
}
.card-note {
  max-width: 36ch;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.65;
}
.card-note strong { color: var(--ink); }

.word {
  margin: 4px 0 0;
  font-family: var(--nepali);
  font-size: clamp(46px, 10vw, 84px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  white-space: nowrap;
}
.roman {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
}
.card--word .card-note { margin-top: 24px; }

/* Result */
.result { max-width: 720px; }
.result > .eyebrow { margin-bottom: 14px; }
.result h2 {
  margin: 0 0 12px;
  font: 400 clamp(34px, 5.4vw, 52px)/1.12 var(--serif);
  letter-spacing: -1.5px;
}
.result-note {
  max-width: 56ch;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 30px;
}
.answer {
  margin: 0 0 30px;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--line);
  background: var(--paper-deep);
}
.answers .answer {
  margin: 0;
  padding: clamp(20px, 3vw, 30px);
}
.answer .eyebrow { margin-bottom: 10px; color: var(--muted); }
.answer .word { font-size: clamp(34px, 8vw, 72px); }
.answers .answer .word { font-size: clamp(32px, 5.2vw, 54px); }
.answer .roman { margin-top: 8px; }
.answers .answer .roman { font-size: 11px; letter-spacing: 1.8px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-block: 22px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.footer p { margin: 0; }

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

@media (prefers-reduced-motion: no-preference) {
  .card > * { animation: rise .4s cubic-bezier(.2, .7, .3, 1) both; }
  .card > *:nth-child(2) { animation-delay: .04s; }
  .card > *:nth-child(3) { animation-delay: .08s; }
  .card > *:nth-child(4) { animation-delay: .12s; }
  .card > *:nth-child(5) { animation-delay: .16s; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }
}

@media (max-width: 900px) {
  .header { min-height: 100px; }
  .intro-grid { grid-template-columns: 1fr; gap: 40px; }
  .how { max-width: 560px; }
  h1 { letter-spacing: -2px; }
}

@media (max-width: 600px) {
  .header { min-height: 88px; }
  .brand img { width: 118px; }
  .header-note { font-size: 10px; letter-spacing: 1.1px; }
  h1 { font-size: clamp(40px, 11vw, 58px); letter-spacing: -1.5px; }
  .lede { margin-bottom: 28px; }
  .button { width: 100%; }
  .start { min-width: 0; }
  .card { min-height: 54vh; }
  .answers { grid-template-columns: 1fr; }
  .footer { flex-direction: column; gap: 8px; }
}

@media (max-width: 400px) {
  .setup { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
}

@media (max-width: 360px) {
  .word { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
