@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #173c31;
  --green: #146c54;
  --mint: #dff5e9;
  --orange: #ff6b43;
  --cream: #f6f4ec;
  --line: #d8ddd5;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: "DM Sans", "Noto Sans JP", sans-serif; }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(255,107,67,.4); outline-offset: 3px; }
[hidden] { display: none !important; }
main { min-height: 100vh; overflow: hidden; }

.topbar {
  height: 76px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(28px, calc((100vw - 1280px) / 2)); border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.brand-dot { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--orange); line-height: 1; letter-spacing: 0; transform: rotate(-8deg); }
.header-actions { display: flex; gap: 12px; align-items: center; }
.status { font-size: 11px; letter-spacing: .1em; font-weight: 700; margin-right: 16px; }
.status i { display: inline-block; width: 7px; height: 7px; background: #31ba72; border-radius: 50%; margin-right: 7px; box-shadow: 0 0 0 4px #d9eee2; }
.icon-button, .reset-button { border: 1px solid var(--line); background: transparent; height: 38px; cursor: pointer; }
.icon-button { width: 38px; border-radius: 50%; }
.reset-button { border-radius: 999px; padding: 0 18px; font-weight: 600; font-size: 12px; }

.hero { max-width: 1280px; margin: 0 auto; padding: 12px 28px 32px; display: flex; align-items: end; justify-content: space-between; }
.eyebrow { color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.eyebrow span { margin-right: 8px; }
h1 { margin: 17px 0 0; font-family: "Noto Sans JP", sans-serif; font-size: clamp(44px, 6vw, 82px); line-height: 1.08; letter-spacing: -.06em; font-weight: 800; }
h1 em { color: var(--orange); font-style: normal; }
.lead { border-left: 2px solid var(--orange); padding-left: 24px; line-height: 2; font-size: 14px; font-weight: 500; margin: 0 0 8px; }

.workspace { max-width: 1280px; margin: 0 auto 40px; padding: 0 28px; display: grid; grid-template-columns: 300px 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.control-panel { padding: 32px 30px 32px 0; border-right: 1px solid var(--line); }
.panel-step { display: flex; gap: 14px; align-items: center; margin-bottom: 34px; }
.panel-step > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-size: 11px; font-weight: 700; }
.panel-step strong, .panel-step small, .setting-label small, .history small { display: block; }
.panel-step strong { font-size: 14px; }
.panel-step small, .setting-label small, .history small { margin-top: 3px; color: #8c9993; font-size: 9px; letter-spacing: .12em; font-weight: 700; }
.setting-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.setting-label strong { font-size: 13px; }
.setting-label b { color: var(--orange); font-size: 13px; }
.size-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.size-grid button { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 59px; cursor: pointer; }
.size-grid button strong, .size-grid button small { display: block; }
.size-grid button strong { font-size: 14px; }
.size-grid button small { color: #9aa39f; font-size: 9px; margin-top: 3px; }
.size-grid button.active { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 8px 20px rgba(20,108,84,.16); }
.size-grid button.active small { color: #b8dfd1; }
.hint { color: #7b8983; font-size: 9px; line-height: 1.6; margin: 15px 0 24px; }
.hint span { display: inline-grid; place-items: center; border: 1px solid #adb7b2; width: 15px; height: 15px; border-radius: 50%; margin-right: 5px; }
.new-card { width: 100%; height: 48px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--ink); background: transparent; border-radius: 7px; padding: 0 18px; font-size: 11px; font-weight: 700; cursor: pointer; }
.new-card:hover { background: var(--ink); color: #fff; }
.draw-progress { margin-top: 31px; font-size: 10px; }
.draw-progress b { float: right; color: var(--orange); }
.draw-progress > div { height: 4px; background: #dde1dd; margin-top: 10px; border-radius: 4px; overflow: hidden; }
.draw-progress i { display: block; height: 100%; background: var(--orange); transition: width .3s; }
.ad-unit { margin-top: 24px; min-width: 0; overflow: hidden; }

.game-panel { padding: 32px 0 38px 36px; position: relative; }
.game-head { display: flex; align-items: start; justify-content: space-between; }
.game-head .panel-step { margin-bottom: 28px; }
.bingo-counter { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 14px; font-size: 9px; letter-spacing: .12em; }
.bingo-counter strong { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); color: #fff; font-size: 13px; }
.game-layout { display: grid; grid-template-columns: minmax(360px, 610px) minmax(180px, 1fr); gap: 44px; align-items: center; }
.bingo-board { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); background: #e7e9e4; border-radius: 11px; }
.bingo-board button { aspect-ratio: 1; min-width: 0; border: 0; border-radius: 5px; background: #fff; font-size: clamp(13px, 2.2vw, 30px); font-weight: 700; cursor: pointer; box-shadow: 0 1px 0 rgba(23,60,49,.08); transition: transform .16s, background .16s; }
.bingo-board button:hover { transform: translateY(-2px); }
.bingo-board button.marked { background: var(--mint); color: var(--green); box-shadow: inset 0 0 0 2px #95d0b9; }
.bingo-board button.winner { background: var(--orange); color: #fff; box-shadow: 0 0 0 3px #ffd7ca; }
.bingo-board button small, .bingo-board button span { display: block; }
.bingo-board button small { font-size: .32em; letter-spacing: .12em; }
.bingo-board button span { font-size: .58em; margin-top: 2px; }
.bingo-board.size-7, .bingo-board.size-8, .bingo-board.size-9, .bingo-board.size-10 { gap: 4px; padding: 7px; }
.bingo-board.size-7 button, .bingo-board.size-8 button, .bingo-board.size-9 button, .bingo-board.size-10 button { font-size: clamp(10px, 1.65vw, 20px); }
.draw-area { text-align: center; }
.current-number small { font-size: 9px; letter-spacing: .2em; font-weight: 700; color: #8c9993; }
.current-number strong { display: block; font-size: clamp(70px, 10vw, 130px); line-height: 1; margin: 7px 0; letter-spacing: -.07em; }
.current-number span { font-size: 10px; font-weight: 600; color: #84918c; }
.draw-button { width: 100%; max-width: 240px; margin: 24px auto; background: var(--orange); color: white; border: 0; border-radius: 9px; padding: 15px; cursor: pointer; box-shadow: 0 10px 20px rgba(255,107,67,.2); }
.draw-button:hover { transform: translateY(-2px); }
.draw-button:disabled { opacity: .5; cursor: default; }
.draw-button span, .draw-button small { display: block; }
.draw-button span { font-size: 15px; font-weight: 700; }
.draw-button small { font-size: 8px; letter-spacing: .16em; margin-top: 3px; opacity: .8; }
.history { border-top: 1px solid var(--line); padding-top: 18px; text-align: left; }
.history > div:first-child { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.history-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; height: 190px; overflow-y: auto; scrollbar-width: thin; align-content: flex-start; }
.history-list span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #fff; border: 1px solid var(--line); font-size: 10px; font-weight: 700; }
.history-list span.latest { color: #fff; background: var(--ink); }
.history-list p { width: 100%; text-align: center; color: #99a29e; font-size: 10px; }
.celebration { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%) rotate(-3deg); padding: 15px 28px; color: #fff; background: var(--orange); border: 4px solid white; box-shadow: 0 15px 45px rgba(23,60,49,.25); font-size: 32px; font-weight: 800; letter-spacing: .08em; pointer-events: none; animation: pop .35s ease-out; }
.celebration span { display: block; text-align: center; font-size: 9px; letter-spacing: .1em; margin-top: 3px; }
@keyframes pop { from { transform: translate(-50%,-50%) rotate(-3deg) scale(.4); opacity: 0; } }

footer { max-width: 1224px; margin: 0 auto; padding: 0 0 36px; display: flex; align-items: center; justify-content: space-between; color: #89958f; font-size: 9px; letter-spacing: .12em; }
footer p { color: var(--ink); font-size: 11px; font-weight: 700; }
footer b { color: var(--orange); margin-left: 8px; }

@media (max-width: 850px) {
  .hero { padding-top: 42px; align-items: start; }
  .lead { display: none; }
  .workspace { grid-template-columns: 1fr; border-bottom: 0; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .size-grid { grid-template-columns: repeat(8, 1fr); }
  .size-grid button { min-height: 52px; }
  .size-grid button small { display: none; }
  .game-panel { padding-left: 0; }
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .draw-area { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 16px; }
  .current-number strong { font-size: 84px; }
  .history { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .topbar { height: 64px; padding: 0 18px; }
  .brand { font-size: 12px; }
  .status, .reset-button span { display: none; }
  .reset-button { padding: 0 12px; }
  .hero { padding: 38px 18px 34px; }
  h1 { font-size: 43px; }
  .workspace { padding: 0 18px; margin-bottom: 24px; }
  .control-panel, .game-panel { padding-top: 26px; }
  .panel-step { margin-bottom: 24px; }
  .size-grid { grid-template-columns: repeat(4, 1fr); }
  .game-layout { gap: 24px; }
  .bingo-board { gap: 4px; padding: 6px; }
  .draw-area { grid-template-columns: 1fr; }
  .draw-button { margin: 0 auto; }
  .history { grid-column: auto; }
  footer { padding: 0 18px 28px; }
  footer span { display: none; }
  footer p { margin: auto; }
}
