/* Colors and spacing live in one place, making the design easy to customize. */
:root {
  --paper: #f8f7f2;
  --white: #fffefa;
  --ink: #253c30;
  --green: #284d3a;
  --muted: #606b5e;
  --line: #e2e4da;
  --sage: #edf1e7;
  --orange: #bc5e36;
  --serif: Georgia,'Times New Roman',serif;
  --sans:  'Segoe UI',system-ui,-apple-system,sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

button,input {
  font: inherit;
}

button,a,input {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .5;
}

button {
  transition: background .18s,transform .18s;
}

button:focus-visible,a:focus-visible,input:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 4px;
}

button:not(:disabled):active {
  transform: translateY(1px);
}

[hidden] {
  display: none!important;
}

.site-shell {
  max-width: 1180px;
  margin: auto;
  padding: 0 48px;
}

.site-header {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -1.4px;
}

.brand svg {
  width: 34px;
  height: 34px;
}

.brand-dot {
  color: var(--orange);
  margin-left: -10px;
}

.text-button {
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
}

.text-button span {
  margin-left: 12px;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 53px 0 39px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.9px;
  margin: 0 0 17px;
}

.small-star {
  color: var(--orange);
  font-size: 19px;
  vertical-align: middle;
  margin-right: 8px;
}

h1 {
  font-family: var(--serif);
  font-size: 57px;
  line-height: 1.08;
  letter-spacing: -2.3px;
  font-weight: 400;
  margin: 0 0 19px;
}

h1 em {
  color: var(--green);
  font-weight: 400;
}

.intro-copy {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}

.intro-art {
  width: 300px;
  height: 210px;
  position: relative;
  margin-right: 40px;
}

.word-tile {
  position: absolute;
  display: grid;
  place-items: center;
  width: 117px;
  height: 126px;
  border: 1px solid #d8dccd;
  border-radius: 14px;
  font-family: var(--serif);
  font-size: 35px;
  box-shadow: 0 12px 20px #253c3007;
}

.tile-one {
  background: #e9eddc;
  left: 0;
  top: 44px;
  transform: rotate(-12deg);
}

.tile-two {
  background: #f4e6d8;
  right: 0;
  top: 60px;
  transform: rotate(13deg);
  color: #905636;
}

.art-arrow {
  position: absolute;
  left: 125px;
  top: 75px;
  font-family: var(--serif);
  font-size: 38px;
  color: var(--muted);
}

.art-spark {
  position: absolute;
  right: 7px;
  top: 0;
  font-size: 39px;
  color: var(--orange);
}

.art-label {
  position: absolute;
  left: 10px;
  top: 4px;
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  transform: rotate(-5deg);
  color: var(--muted);
}

.setup {
  display: flex;
  gap: 38px;
  align-items: flex-end;
  padding: 23px 0 29px;
  border-top: 1px solid var(--line);
}

.control-label {
  font-size: 9px;
  letter-spacing: 1.6px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 11px;
}

.level-picker {
  flex: 1;
}

.levels {
  display: grid;
  grid-template-columns: repeat(6,1fr);
  gap: 6px;
}

.levels button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 5px 7px;
  min-width: 65px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
}

.levels button span {
  display: block;
  font-size: 9px;
  font-weight: 400;
  opacity: .8;
  margin-top: 1px;
}

.levels button[aria-pressed=true] {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}

.levels button:hover:not([aria-pressed=true]) {
  background: var(--sage);
}

.modes {
  display: flex;
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 8px;
  gap: 2px;
  height: 57px;
  align-items: center;
}

.modes button {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 11px;
  white-space: nowrap;
}

.modes button[aria-pressed=true] {
  background: var(--sage);
  color: var(--green);
  font-weight: 650;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 292px;
  gap: 23px;
  align-items: start;
}

.game-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 32px 22px;
  min-height: 510px;
  box-shadow: 0 5px 15px #253c3003;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.round-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.level-badge {
  font-size: 10px;
  color: var(--green);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 4px 10px;
}

#challenge {
  text-align: center;
  padding: 30px 0 24px;
}

.relation-tag {
  display: inline-block;
  background: var(--sage);
  border-radius: 5px;
  padding: 4px 11px;
  color: var(--green);
  font-size: 9px;
  letter-spacing: 1.4px;
  font-weight: 700;
}

.relation-tag.opposite {
  background: #f7eae0;
  color: #995536;
}

#challenge h2 {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin: 14px 0 0;
}

.prompt-word {
  font-family: var(--serif);
  font-size: 64px;
  line-height: 1.25;
  letter-spacing: -1.7px;
  margin: 10px 0 4px;
  overflow-wrap: anywhere;
}

.word-context {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  min-height: 20px;
}

.attempts-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin: 0 0 22px;
}

.attempts-row p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.lives {
  display: flex;
  gap: 6px;
}

.lives span {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.lives span.used {
  background: #e4e7df;
}

.input-row {
  display: flex;
  gap: 9px;
}

input {
  min-width: 0;
  flex: 1;
  background: var(--white);
  border: 1px solid #d7dccf;
  border-radius: 8px;
  padding: 13px 15px;
  /* iOS can zoom into smaller input text on focus. Keep this at least 16px,
     including landscape/tablet layouts; normal pinch-to-zoom remains available. */
  font-size: 16px;
  color: var(--ink);
}

input::placeholder {
  color: var(--muted);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--green);
  color: white;
  border: 1px solid var(--green);
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.primary-button:hover:not(:disabled) {
  background: #1d3a2a;
}

.primary-button span {
  font-size: 17px;
  line-height: 1;
}

.feedback {
  font-size: 12px;
  color: var(--orange);
  min-height: 28px;
  margin-top: 10px;
}

.feedback.success {
  color: var(--green);
}

.guess-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.guess-chip {
  font-size: 11px;
  background: #f5eee7;
  color: #895437;
  padding: 3px 9px;
  border-radius: 5px;
}

.guess-chip.correct {
  background: var(--sage);
  color: var(--green);
}

.game-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 17px;
  margin-top: 13px;
  gap: 10px;
}

.hint-button {
  background: transparent;
  border: 0;
  color: var(--ink);
  padding: 0;
  font-size: 11px;
  display: flex;
  gap: 7px;
  align-items: center;
}

.hint-button>span:first-child {
  font-size: 20px;
}

.hint-cost {
  color: var(--muted);
  font-size: 10px;
  margin-left: 4px;
}

.keyboard-tip {
  color: var(--muted);
  font-size: 10px;
}

.hint-copy {
  background: var(--sage);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 0;
}

.result {
  background: var(--sage);
  padding: 18px;
  border-radius: 10px;
  margin: 8px 0 19px;
}

.result.lost {
  background: #f7eee5;
}

.result h3 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 400;
  margin: 0 0 5px;
}

.result p {
  font-size: 12px;
  margin: 0 0 15px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.progress-card {
  border-radius: 13px;
  border: 1px solid #dce2d2;
  background: #eff2e8;
  padding: 21px 23px;
}

.side-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.side-heading h2 {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}

.side-heading>span {
  font-size: 20px;
  color: #73816b;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 9px 0 17px;
}

.big-score {
  font-family: var(--serif);
  font-size: 56px;
  line-height: 1.2;
  letter-spacing: -1px;
  overflow-wrap: anywhere;
}

.score-caption {
  font-size: 10px;
  line-height: 1.6;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid #d8dfce;
  border-bottom: 1px solid #d8dfce;
  padding: 15px 0;
}

.stat-grid>div+div {
  padding-left: 20px;
  border-left: 1px solid #d8dfce;
}

.stat-grid span {
  font-size: 22px;
  font-family: var(--serif);
}

.stat-grid p {
  margin: 1px 0 0;
  font-size: 10px;
  color: var(--muted);
}

.accuracy {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  padding-top: 16px;
  color: var(--muted);
}

.accuracy strong {
  font-weight: 600;
  color: var(--ink);
}

.milestone {
  font-size: 10px;
  line-height: 1.6;
  color: var(--green);
  margin: 10px 0 0;
}

.tip-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 21px 23px;
  position: relative;
}

.tip-icon {
  position: absolute;
  right: 22px;
  top: 14px;
  font-size: 29px;
  color: #b4bba9;
}

.tip-card .eyebrow {
  font-size: 8px;
  letter-spacing: 1.3px;
  margin: 0 0 12px;
}

.tip-card h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -.5px;
  margin: 0 0 14px;
}

.tip-card p:not(.eyebrow) {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  margin: 9px 0;
}

.tip-card strong {
  font-weight: 600;
  color: var(--ink);
}

.tip-card .tip-note {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 10px!important;
}

.fresh-note {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  margin: 0;
  line-height: 1.9;
}

.fresh-note>span {
  font-size: 15px;
  color: var(--green);
  margin-right: 5px;
}

.fresh-note small {
  display: block;
  font-size: 9px;
}

.level-note {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  margin: 26px 0 35px;
}

.notice {
  border: 1px solid #e4c8ae;
  border-radius: 8px;
  padding: 12px;
  color: #895437;
  font-size: 12px;
}

footer {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 23px 0 26px;
  color: var(--muted);
  font-size: 10px;
}

.footer-star {
  color: var(--orange);
  font-size: 19px;
  margin-left: 13px;
  vertical-align: middle;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 38px;
  max-width: 550px;
  width: calc(100% - 32px);
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 20px 100px #253c3033;
}

dialog::backdrop {
  background: #253c3066;
  backdrop-filter: blur(3px);
}

dialog h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.2;
  margin: 0 0 18px;
}

dialog p,dialog li {
  font-size: 13px;
  color: var(--muted);
}

dialog ol {
  padding-left: 20px;
}

dialog li {
  padding-left: 5px;
  margin-bottom: 10px;
}

.dialog-close {
  position: absolute;
  right: 17px;
  top: 11px;
  font-size: 26px;
  background: none;
  border: 0;
  color: var(--muted);
}

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

/* Layout changes keep controls usable on phones, without horizontal scrolling. */
@media(min-width:1400px) {
  .site-shell {
    max-width: 1280px;
  }
  .intro {
    padding-top: 65px;
    padding-bottom: 48px;
  }
  .play-layout {
    grid-template-columns: minmax(0,1fr) 310px;
  }
  .game-card {
    padding: 30px 40px;
  }
  #challenge {
    padding: 39px 0 29px;
  }
  .setup {
    gap: 55px;
  }
}

@media(max-width:1000px) {
  .site-shell {
    padding: 0 30px;
  }
  .setup {
    flex-wrap: wrap;
    gap: 20px;
  }
  .level-picker {
    min-width: 100%;
  }
  .modes {
    height: 44px;
  }
  .play-layout {
    grid-template-columns: minmax(0,1fr) 260px;
    gap: 17px;
  }
  .game-card {
    padding: 23px;
  }
  .intro-art {
    margin-right: 0;
    transform: scale(.85);
    transform-origin: right center;
  }
  h1 {
    font-size: 50px;
  }
  .input-row {
    flex-direction: column;
  }
  .input-row .primary-button {
    padding: 11px;
  }
  .keyboard-tip {
    display: none;
  }
  .prompt-word {
    font-size: 54px;
  }
}

@media(max-width:720px) {
  .site-shell {
    padding: 0 20px;
  }
  .site-header {
    height: 78px;
  }
  /* Generous touch targets make the controls easier to use with a thumb. */
  .text-button,
  .hint-button,
  .dialog-close {
    min-height: 44px;
  }
  .dialog-close {
    min-width: 44px;
    right: 8px;
    top: 8px;
  }
  .brand {
    font-size: 24px;
  }
  .intro {
    padding: 34px 0 27px;
  }
  .intro-art {
    display: none;
  }
  h1 {
    font-size: 48px;
  }
  .intro-copy {
    font-size: 13px;
  }
  .setup {
    padding: 20px 0 22px;
    gap: 17px;
  }
  .levels {
    gap: 5px;
  }
  .levels button {
    min-width: 0;
    min-height: 48px;
    font-size: 14px;
    padding: 9px 1px;
  }
  .levels button span {
    font-size: 10px;
  }
  .mode-picker {
    width: 100%;
  }
  .modes {
    width: 100%;
    height: auto;
    min-height: 52px;
  }
  .modes button {
    flex: 1;
    min-height: 44px;
    padding: 10px 8px;
    font-size: 12px;
  }
  .play-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .game-card {
    padding: 23px 22px;
    min-height: 0;
  }
  .prompt-word {
    font-size: clamp(36px,9vw,58px);
  }
  #challenge {
    padding: 26px 0 21px;
  }
  .input-row {
    /* Full-width controls leave room for longer answers and keyboard input. */
    flex-direction: column;
  }
  input,
  .primary-button {
    min-height: 48px;
  }
  .primary-button {
    font-size: 14px;
  }
  .input-row .primary-button {
    padding: 12px;
  }
  .feedback,
  .word-context,
  .hint-copy {
    font-size: 14px;
  }
  .hint-button {
    font-size: 13px;
  }
  .game-bottom {
    padding-top: 10px;
  }
  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
  }
  .progress-card,.tip-card {
    padding: 18px;
  }
  .tip-card h2 {
    font-size: 24px;
  }
  .fresh-note {
    grid-column: 1/-1;
  }
  .stat-grid>div+div {
    padding-left: 11px;
  }
  .score-row {
    gap: 8px;
  }
  .big-score {
    font-size: 46px;
  }
  .score-caption {
    font-size: 9px;
  }
  .side-heading h2 {
    font-size: 11px;
  }
  .side-heading>span {
    display: none;
  }
  .level-note {
    margin: 22px 0 26px;
  }
  footer {
    gap: 16px;
    font-size: 9px;
  }
  .footer-star {
    margin-left: 5px;
  }
  dialog {
    padding: 30px 24px;
  }
  .eyebrow {
    font-size: 9px;
    letter-spacing: 1.5px;
  }
}

/* Stack the secondary cards before their contents become cramped. */
@media(max-width:520px) {
  .sidebar {
    grid-template-columns: 1fr;
  }
}

@media(max-width:380px) {
  .site-shell {
    padding: 0 14px;
  }
  h1 {
    font-size: 43px;
  }
  .hint-cost {
    font-size: 9px;
  }
}

/* Respect people who prefer less motion. */
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    transition: none!important;
    animation: none!important;
    scroll-behavior: auto!important;
  }
}
