* { box-sizing: border-box; }
body { margin: 0; background: #fff; color: #000; font: 14px Arial, Helvetica, sans-serif; }
button, input, select { font: inherit; color: #000; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
h1 { font-size: 28px; margin: 0 0 20px; }
h2 { font-size: 20px; margin: 0; }
p { line-height: 1.3; }
.setup { width: 480px; max-width: 100%; margin: 0 auto; padding: 40px 20px 20px; background: #d8d8d8; }
.settings { margin-top: 24px; }
.setting-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.tabs button[aria-selected="true"] { font-weight: bold; outline: 1px solid #555; outline-offset: 1px; }
#date-label { margin: 20px 0 0; }
#target-note { margin: 6px 0 20px; }
.start-area { text-align: right; margin-top: 24px; }
.game-status { display: flex; justify-content: space-between; gap: 20px; padding: 20px; font-size: 18px; font-variant-numeric: tabular-nums; }
.game { margin-top: max(35px, calc(33vh - 62px)); background: #d8d8d8; padding: 20px; }
.game-inner { width: 620px; max-width: 100%; margin: auto; text-align: center; }
.target-row { font-size: 32px; margin: 0 0 20px; }
.target-row strong { font-weight: normal; }
.cards { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.number-card { min-width: 42px; padding: 5px 9px; font-size: 24px; border: 1px solid #888; border-radius: 0; background: #eee; }
.number-card.used { color: #888; border-color: #aaa; text-decoration: line-through; background: #d8d8d8; }
.card-index { display: none; }
.cards-progress { font-size: 12px; color: #444; margin: 10px 0 16px; }
.expression-row { display: flex; justify-content: center; align-items: center; gap: 6px; }
#expression { width: 380px; min-width: 0; padding: 5px; font-size: 24px; background: #fff; border: 1px solid #888; border-radius: 0; }
#expression:focus { outline: 2px solid #3986c6; outline-offset: 0; }
#expression::placeholder { font-size: 18px; }
.operators { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.operators button { min-width: 30px; font-size: 18px; }
.text-button { border: 0; padding: 0; color: #0000ee; text-decoration: underline; background: none; font-size: 13px; }
#give-up { display: inline-block; margin-top: 14px; }
#message { color: #9b1919; margin: 12px 0 0; white-space: pre-line; }
#message:empty { display: none; }
#message.good { color: #000; }
#result { margin-top: 18px; }
.result-kicker { display: none; }
#result h3 { font-size: 20px; font-weight: normal; margin: 0 0 12px; }
#result p { font-size: 14px; }
.solution { overflow-wrap: anywhere; }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.below-game { display: flex; justify-content: center; gap: 16px; margin: 16px 20px; }
.stats { text-align: center; margin: 16px 15px 0; color: #555; font-size: 12px; }
.storage-note { text-align: center; color: #666; font-size: 11px; margin: 8px 15px 20px; }
.in-game .setup, .in-game .stats, .in-game .storage-note { display: none; }
.warning { color: #9b1919; }
dialog { width: 540px; max-width: calc(100% - 30px); max-height: 90dvh; border: 1px solid #888; border-radius: 0; padding: 20px; background: #eee; color: #000; }
dialog::backdrop { background: #0005; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 20px; }
.library-tools { display: flex; gap: 8px; }
.library-tools input { min-width: 0; flex: 1; padding: 3px; }
#library-summary { color: #555; font-size: 12px; }
.library-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #ccc; background: transparent; padding: 9px 0; border-radius: 0; }
.library-row:hover { background: #ddd; }
.library-row strong { width: 60px; font-size: 18px; font-weight: normal; }
.library-numbers { flex: 1; font-size: 12px; }
.library-id { color: #666; font-size: 11px; }
.library-arrow { display: none; }
.library-pager { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; }
dialog a { font-size: 12px; }
.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; }
@media (max-width: 480px) {
  .setup { padding: 30px 20px 20px; }
  .game-status { padding: 15px; font-size: 14px; }
  .game { padding: 18px 15px; margin-top: 70px; }
  .target-row { font-size: 28px; }
  .cards { gap: 6px; }
  .number-card { min-width: 38px; font-size: 21px; padding: 5px 7px; }
  #expression { font-size: 20px; flex: 1; }
  .library-tools { flex-wrap: wrap; }
  .library-id { display: none; }
  .library-row { gap: 8px; }
}
