* {
  box-sizing: border-box;
}
:root {
  color-scheme: light;
  --ink: #172b24;
  --ivory: #f6f3e9;
  --green: #193e32;
  --citrus: #ddfc8a;
  --line: #d0cfc0;
}
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: Inter, 'Helvetica Neue', Arial, sans-serif;
}
button,
select {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 3px solid #e69f35;
  outline-offset: 3px;
}
button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  min-height: 44px;
  touch-action: manipulation;
}
button:disabled {
  opacity: 0.44;
  cursor: default;
}
header,
main,
footer {
  max-width: 1000px;
  margin: auto;
  padding-inline: 28px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.header-actions a,
.section-links a {
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-weight: 650;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.header-actions a {
  padding: 6px;
  font-size: 14px;
}
.section-links {
  display: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.mark {
  font-family: Georgia, serif;
  font-size: 29px;
  line-height: 1;
}
.intro {
  margin: 36px 0 23px;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font:
    normal clamp(46px, 7vw, 76px) / 1.04 Georgia,
    serif;
  letter-spacing: -0.064em;
}
h1 span {
  color: #828d45;
}
.intro p {
  margin-top: 9px;
  color: #526458;
  font-size: 15px;
}
.table {
  display: grid;
  grid-template-columns: minmax(240px, 1.28fr) minmax(235px, 0.8fr);
  gap: 18px;
  align-items: start;
}
.mat,
.coach {
  border-radius: 18px;
  min-width: 0;
  scroll-margin-top: 12px;
}
.mat {
  padding: 24px;
  background: var(--green);
  color: #f3f4dc;
  box-shadow: inset 0 0 0 1px #0b3024;
}
.mat-head,
.mat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.mat-head h2 {
  font:
    normal 27px Georgia,
    serif;
}
.mat-head span,
.mat-foot span {
  font-size: 12px;
  color: #d5e4cb;
}
.mat-foot button {
  color: #eef4df;
  border-color: #5b7966;
}
.mat-foot {
  margin-top: 21px;
}
#grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 18px;
}
.slot {
  width: 100%;
  padding: 2px;
  position: relative;
  background: #f7f4db;
  color: #233c2d;
  font:
    bold clamp(22px, 4.6vw, 43px) Georgia,
    serif;
  min-height: 65px;
  aspect-ratio: 1.45;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.slot.hidden {
  background: repeating-linear-gradient(45deg, #395a49 0 2px, #335341 2px 7px);
  color: #d4e1c7;
  border: 1px solid #577564;
}
.slot.gone {
  background: transparent;
  border: 1px dashed #78907b;
  color: #b6c5ac;
  font-size: 18px;
}
.slot.neg {
  background: #cce6ce;
}
.slot.high {
  background: #f2cd9a;
}
.slot.suggest {
  outline: 3px solid var(--citrus);
  outline-offset: 2px;
}
.coach {
  border: 1px solid var(--line);
  background: #fffcf3;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.coach > h2 {
  font: normal 27px/1.12 Georgia, serif;
}
.coach label,
.advice small,
.pile-label {
  font-weight: 700;
  font-size: 13px;
  color: #4b604f;
}
.strategy-field {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.coach select {
  min-height: 44px;
  max-width: 100%;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf5;
}
.piles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 3px 0;
}
.piles button {
  display: flex;
  min-width: 0;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px;
  border-color: #9aa98f;
  background: #f5f1df;
  text-align: left;
}
.piles .pile-label {
  color: inherit;
  line-height: 1.2;
}
.piles strong {
  font: normal 30px/1 Georgia, serif;
  font-variant-numeric: tabular-nums;
}
#drawn {
  background: var(--green);
  color: #f6f7df;
  border-color: var(--green);
}
#drawn:disabled {
  opacity: 1;
  color: #536b5d;
  background: #e1e8d9;
  border-color: #a6b59f;
}
.piles button[aria-pressed='true'] {
  box-shadow: inset 0 0 0 2px currentColor;
}
.advice {
  padding: 15px 0 5px;
  border-top: 1px solid var(--line);
}
.advice h2 {
  font:
    normal 26px/1.15 Georgia,
    serif;
  margin: 5px 0 6px;
}
.advice p {
  font-size: 14px;
  line-height: 1.45;
  color: #475a4d;
}
.primary {
  background: var(--citrus);
  border-color: #adc16f;
  font-weight: 700;
  min-height: 46px;
}
#feedback {
  color: #385842;
  font-size: 14px;
  line-height: 1.4;
}
#feedback:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#undo {
  align-self: flex-start;
  border: 0;
  font-size: 13px;
}
footer {
  display: flex;
  justify-content: space-between;
  margin: 24px auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: #546659;
}
dialog {
  width: min(380px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ivory);
  color: var(--ink);
  padding: 20px;
}
dialog::backdrop {
  background: #0b221ac4;
}
dialog h2 {
  font:
    normal 27px Georgia,
    serif;
  margin-bottom: 6px;
}
#pick-detail {
  margin-bottom: 14px;
  color: #455b50;
  font-size: 14px;
  line-height: 1.45;
}
#numbers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
#numbers button {
  min-width: 0;
  min-height: 46px;
  padding: 4px;
  background: #fffdf5;
  font-weight: 650;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
#numbers button[aria-pressed='true'],
#special button[aria-pressed='true'] {
  color: var(--ivory);
  background: var(--green);
  border-color: var(--green);
}
#special {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0;
}
#special button {
  flex: 1 1 auto;
  background: #f1f1e6;
}
#special:empty {
  margin: 0;
}
#cancel {
  min-width: 70px;
  margin-top: 6px;
}
#rulecard {
  display: none;
  max-width: 580px;
  margin: 6vh auto;
  padding: 30px;
  border: 1px solid var(--line);
  background: #fffdf6;
}
#rulecard h1 {
  font-size: 45px;
}
#rulecard p,
#rulecard li {
  line-height: 1.6;
  margin: 12px 0;
}
#rulecard ol {
  padding-left: 22px;
}
.show-card > header,
.show-card > main,
.show-card > footer {
  display: none;
}
.show-card > #rulecard {
  display: block;
}
[hidden] {
  display: none !important;
}
@media screen and (max-width: 680px) {
  header,
  main,
  footer {
    padding-inline: clamp(10px, 3vw, 18px);
  }
  header {
    min-height: 56px;
    gap: 6px;
  }
  .brand {
    gap: 6px;
    min-width: 0;
    font-size: 14px;
    line-height: 1.15;
  }
  .header-actions {
    gap: 2px;
    flex-shrink: 0;
  }
  .header-actions a,
  .header-actions button {
    padding-inline: 8px;
    white-space: nowrap;
    font-size: 13px;
  }
  .intro {
    margin: 17px 0 6px;
  }
  .intro h1 {
    font-size: clamp(39px, 10vw, 48px);
  }
  .intro p {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.4;
  }
  .section-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0 0 6px;
    font-size: 14px;
  }
  .table {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .mat,
  .coach {
    padding: clamp(12px, 3.5vw, 18px);
  }
  .slot {
    min-height: 48px;
    aspect-ratio: 1.6;
    font-size: clamp(26px, 7.3vw, 36px);
  }
  #grid {
    gap: 7px;
    margin-top: 12px;
  }
  .mat-foot {
    margin-top: 10px;
  }
  .coach {
    gap: 9px;
  }
  .piles button {
    min-height: 56px;
  }
  footer {
    flex-wrap: wrap;
    gap: 5px 12px;
    padding-bottom: 16px;
  }
}
@media screen and (max-width: 360px) {
  .header-actions a,
  .header-actions button {
    font-size: 12px;
    padding-inline: 6px;
  }
  dialog {
    padding: 15px;
  }
}
@media print {
  body > header,
  body > main,
  body > footer,
  dialog,
  button {
    display: none !important;
  }
  #rulecard {
    display: block !important;
    border: 1px solid #555;
    color: #111;
    margin: 0;
    padding: 18mm;
    width: 145mm;
  }
}
@media print {
  #rulecard { padding: 10mm; width: 143mm; }
  #rulecard h1 { font-size: 33px; }
  #rulecard p, #rulecard li { font-size: 14px; line-height: 1.4; }
}
