.wordhorse-body {
  background: #fff;
}

.wordhorse-shell {
  width: min(900px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.wordhorse-header,
.wordhorse-nav,
.wordhorse-topline,
.wordhorse-goal-line,
.wordhorse-rules,
.wordhorse-modal-actions {
  display: flex;
  align-items: center;
}

.wordhorse-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}

.wordhorse-header::after { content: ""; }

.wordhorse-nav { gap: 8px; }
.wordhorse-nav a { padding: 8px 11px; border-radius: 999px; color: var(--muted); font-size: .92rem; font-weight: 700; }
.wordhorse-nav a.is-active { color: #fff; background: var(--ink); }

.wordhorse-rules-button,
.wordhorse-stats-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.wordhorse-topline-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

.wordhorse-stats-button {
  background: #f8f1e8;
}

.wordhorse-rules-button:hover { border-color: rgba(138, 99, 55, .35); background: #faf7f2; }
.wordhorse-stats-button:hover { border-color: rgba(138, 99, 55, .35); background: #f1e3d2; }
.wordhorse-rules-button svg,
.wordhorse-stats-button svg { display: block; width: 21px; height: 21px; stroke: currentColor; }

.wordhorse-main { margin-top: 42px; }

.wordhorse-topline {
  justify-content: space-between;
  gap: 20px;
  text-align: center;
}

.wordhorse-topline > div { flex: 1 1 0; }
.wordhorse-topline > div:first-child { text-align: left; }
.wordhorse-topline > div:last-child { text-align: right; }
.wordhorse-puzzle-number { margin: 0; font-size: 1.05rem; font-weight: 800; }
.wordhorse-title-wrap h1 { font-size: clamp(2.7rem, 6.4vw, 4.2rem); }
.wordhorse-title-wrap h1 span { display: block; margin-top: 3px; color: var(--accent-deep); font-family: "IBM Plex Sans", sans-serif; font-size: .22em; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.wordhorse-title-wrap p { margin: 8px 0 0; color: var(--muted); font-size: .95rem; }


.wordhorse-board-wrap { width: min(100%, 340px); margin: 26px auto 0; }
.wordhorse-goal-line { justify-content: space-between; margin-bottom: 13px; color: var(--muted); font-size: .84rem; font-weight: 700; }
.wordhorse-goal-line strong { color: var(--ink); letter-spacing: .08em; }

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

.wordhorse-board-scroller {
  max-height: 350px;
  overflow-y: auto;
  padding: 2px 8px 2px 2px;
  scrollbar-color: #c9b99f transparent;
  scrollbar-width: thin;
}

.wordhorse-tile {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid #d3d6da;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-size: clamp(1.2rem, 4.2vw, 1.7rem);
  font-weight: 800;
  line-height: 1;
  transition: transform 190ms ease, background-color 190ms ease, border-color 190ms ease;
}

.wordhorse-tile.is-miss { border-color: #787c7e; color: #fff; background: #787c7e; }
.wordhorse-tile.is-correct { border-color: #6aaa64; color: #fff; background: #6aaa64; }
.wordhorse-tile.is-flip { transform: rotateX(360deg); }
.wordhorse-tile.is-shake { animation: wordhorse-shake 360ms ease; }

.wordhorse-message { min-height: 2.8em; margin: 15px auto 0; color: var(--muted); font-size: .93rem; line-height: 1.45; text-align: center; }
.wordhorse-message.is-error { color: #a64b42; font-weight: 700; }
.wordhorse-message.is-success { color: #4e8548; font-weight: 700; }

.wordhorse-keyboard { width: min(100%, 560px); margin: 24px auto 0; }
.wordhorse-guide { margin: 68px auto 24px; padding: 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: .96rem; line-height: 1.75; }
.wordhorse-guide h2 { margin: 34px 0 10px; color: var(--ink); font-family: "IBM Plex Sans", sans-serif; font-size: 1.35rem; line-height: 1.25; }
.wordhorse-guide h2:first-of-type { margin-top: 10px; }
.wordhorse-guide p { margin: 0 0 16px; }
.wordhorse-guide strong { color: var(--ink); }
.wordhorse-keyboard-row { display: flex; justify-content: center; gap: 6px; margin-bottom: 7px; }
.wordhorse-key {
  min-width: 33px;
  height: 50px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: #d3d6da;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 800;
}
.wordhorse-key.wide { min-width: 58px; font-size: .7rem; }
.wordhorse-key:hover { background: #bfc3c5; }

.wordhorse-modal { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .4); }
.wordhorse-modal.hidden { display: none; }
.wordhorse-rain { position: fixed; z-index: 9; inset: 0; overflow: hidden; pointer-events: none; }
.wordhorse-rain-drop { position: absolute; top: -48px; animation: wordhorse-rain-fall linear forwards; will-change: transform, opacity; }
.wordhorse-modal-card { width: min(470px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.wordhorse-modal-card > p:not(.eyebrow):not(.wordhorse-message) { margin: 18px 0; color: var(--muted); line-height: 1.55; }
.wordhorse-modal-card pre { margin: 18px 0 0; padding: 16px; overflow: auto; border-radius: 16px; background: #f7f3ed; font-family: "IBM Plex Sans", sans-serif; font-size: .9rem; line-height: 1.55; white-space: pre-wrap; }
.wordhorse-modal-actions { gap: 10px; margin-top: 20px; }
.wordhorse-modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.wordhorse-modal-close { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer; font-size: 1.55rem; line-height: 1; }
.wordhorse-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 22px; }
.wordhorse-stats-grid > div { padding: 14px 10px; border: 1px solid var(--line); border-radius: 14px; background: #fafafa; text-align: center; }
.wordhorse-stats-grid span, .wordhorse-next-card span { display: block; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.wordhorse-stats-grid strong { display: block; margin-top: 5px; font-size: 1.3rem; }
.wordhorse-next-card { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 14px 16px; border-radius: 14px; background: #f8f1e8; }
.wordhorse-next-card strong { color: var(--accent-deep); letter-spacing: .07em; }
.wordhorse-today-card { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.wordhorse-today-card > p:not(.status-label):not(.wordhorse-message) { margin: 6px 0 14px; color: var(--muted); line-height: 1.5; }
.wordhorse-today-card .button:disabled { cursor: not-allowed; opacity: .5; }
.wordhorse-rule-list { display: grid; gap: 16px; margin: 24px 0 0; padding: 0; list-style: none; counter-reset: wordhorse-rule; }
.wordhorse-rule-list li { position: relative; min-height: 40px; padding-left: 52px; color: var(--muted); line-height: 1.55; }
.wordhorse-rule-list li::before { counter-increment: wordhorse-rule; content: counter(wordhorse-rule); position: absolute; top: 0; left: 0; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); font-size: .8rem; font-weight: 800; }
.wordhorse-rule-list strong { color: var(--ink); }

@keyframes wordhorse-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes wordhorse-rain-fall { from { transform: translate3d(0, -40px, 0) rotate(0deg); opacity: 1; } to { transform: translate3d(var(--wordhorse-drift), 110vh, 0) rotate(360deg); opacity: 0; } }

@media (max-width: 640px) {
  .wordhorse-shell { width: min(100% - 24px, 500px); padding-top: 15px; }
  .wordhorse-header { display: flex; flex-wrap: wrap; }
  .wordhorse-header::after { display: none; }
  .wordhorse-nav { order: 3; width: 100%; overflow-x: auto; }
  .wordhorse-main { margin-top: 28px; }
  .wordhorse-topline { align-items: flex-start; }
  .wordhorse-topline > div:first-child, .wordhorse-topline > div:last-child { flex: 0 0 auto; }
  .wordhorse-topline > div:last-child { text-align: right; }
  .wordhorse-title-wrap p { display: none; }
  .wordhorse-title-wrap h1 { font-size: 2.7rem; }
  .wordhorse-topline-actions { gap: 5px; }
  .wordhorse-puzzle-number { font-size: .9rem; }
  .wordhorse-board-wrap { width: min(100%, 300px); }
  .wordhorse-board { gap: 5px; }
  .wordhorse-board-scroller { max-height: 310px; padding-right: 5px; }
  .wordhorse-keyboard-row { gap: 4px; }
  .wordhorse-key { min-width: 0; width: 9.3%; height: 47px; padding: 0; }
  .wordhorse-key.wide { width: 15%; min-width: 0; }
  .wordhorse-guide { margin-top: 46px; padding: 26px 0 8px; font-size: .93rem; }
}
