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

:root {
  --ink: #19252a;
  --muted: #728084;
  --paper: #f6f0e7;
  --paper-deep: #ece1d4;
  --orange: #f36f4b;
  --orange-dark: #db5638;
  --yellow: #f3bb52;
  --mint: #a4d9c4;
  --green: #79c668;
  --green-deep: #43a85e;
  --navy: #253e42;
  --line: rgba(25, 37, 42, 0.12);
  --shadow: 0 22px 60px rgba(49, 40, 31, .12);
  font-family: 'DM Sans', 'Noto Sans TC', sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; }
body { background: var(--paper); overflow-x: hidden; }
button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(243, 111, 75, .42); outline-offset: 3px; }

.app-shell { max-width: 1500px; min-height: 100vh; margin: 0 auto; padding: 0 48px 24px; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 800; letter-spacing: .16em; }
.brand-name b { color: var(--orange); }
.brand-mark { width: 26px; height: 26px; position: relative; display: inline-flex; gap: 3px; align-items: flex-end; transform: rotate(-12deg); }
.brand-mark span { display: block; width: 6px; border-radius: 8px; background: var(--orange); }
.brand-mark span:nth-child(1) { height: 14px; opacity: .6; }
.brand-mark span:nth-child(2) { height: 22px; }
.brand-mark span:nth-child(3) { height: 17px; background: var(--green-deep); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.live-pill { color: #5e726f; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.live-pill i { display: inline-block; width: 7px; height: 7px; background: var(--green-deep); border-radius: 50%; margin-right: 7px; box-shadow: 0 0 0 4px rgba(67, 168, 94, .12); }
.icon-button { width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; transform: rotate(-30deg); }
.icon-button.is-muted { opacity: .42; }

.page-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(500px, 1.7fr) minmax(220px, .9fr); gap: 54px; padding: 58px 2vw 38px; align-items: start; }
.intro-panel { padding-top: 26px; }
.eyebrow, .mini-label { font-size: 10px; letter-spacing: .2em; font-weight: 800; color: #7c8a89; }
.eyebrow { display: flex; align-items: center; gap: 9px; }
.eyebrow-dot { width: 9px; height: 9px; border-radius: 3px 50% 50% 50%; background: var(--orange); transform: rotate(45deg); }
h1 { margin: 25px 0 17px; font-size: clamp(48px, 5vw, 75px); line-height: .98; letter-spacing: -.075em; font-weight: 800; }
h1 em { font-style: normal; color: var(--orange); }
.intro-copy { color: #6d7c7c; font-size: 14px; line-height: 1.9; margin: 0; }
.match-summary { max-width: 250px; margin-top: 67px; border-top: 1px solid var(--line); padding-top: 17px; }
.summary-label { display: block; font-size: 10px; color: #9b7f66; font-weight: 800; letter-spacing: .15em; margin-bottom: 11px; }
.summary strong { font-size: 14px; letter-spacing: -.02em; }
.summary-rule { height: 5px; border-radius: 8px; background: #e8ded2; overflow: hidden; margin: 17px 0 13px; }
.summary-rule span { display: block; width: 58%; height: 100%; border-radius: 8px; background: var(--orange); }
.summary-meta { display: flex; justify-content: space-between; color: #9caaa8; font-size: 11px; }
.how-to { margin-top: 105px; display: grid; gap: 10px; }
.how-line { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #6d7c7c; }
.key-chip { min-width: 25px; height: 23px; display: inline-grid; place-items: center; color: var(--ink); background: #fffaf4; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; font-size: 10px; font-weight: 800; }
.key-chip.wide { padding: 0 7px; font-size: 9px; letter-spacing: .04em; }

.game-panel { min-width: 0; }
.game-topline { display: flex; justify-content: space-between; align-items: center; padding: 4px 7px 18px; }
.game-title { display: flex; align-items: center; gap: 9px; color: #768483; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.game-title small { color: #a8b0ae; font-size: 10px; font-weight: 600; letter-spacing: 0; margin-left: 3px; }
.court-pin { width: 10px; height: 10px; border: 2px solid var(--orange); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.score-strip { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.score-side { display: flex; gap: 9px; align-items: center; }
.score-name { font-size: 11px; color: #879492; font-weight: 700; }
.score-side b { display: inline-grid; place-items: center; width: 28px; height: 28px; background: var(--ink); color: white; border-radius: 9px; font-size: 14px; }
.opponent-score b { background: var(--orange); }
.score-dash { color: #b0bab7; }
.court-frame { position: relative; width: 100%; max-width: 570px; margin: auto; border-radius: 28px; padding: 9px; background: #d9a061; box-shadow: 0 18px 0 rgba(174, 111, 57, .15), var(--shadow); overflow: hidden; }
.court-frame::before, .court-frame::after { content: ''; position: absolute; width: 100%; height: 100%; left: 0; top: 0; pointer-events: none; opacity: .18; background-image: repeating-linear-gradient(0deg, transparent 0 21px, rgba(99, 52, 24, .28) 22px 23px); mix-blend-mode: multiply; }
.court-frame::after { background-image: radial-gradient(circle, rgba(255, 238, 196, .8) 0 1px, transparent 1.5px); background-size: 13px 13px; opacity: .16; mix-blend-mode: screen; }
canvas { display: block; width: 100%; height: auto; border-radius: 21px; position: relative; z-index: 1; background: #e9a34d; touch-action: none; }
.canvas-hud { position: absolute; z-index: 3; top: 22px; left: 24px; right: 24px; display: flex; justify-content: space-between; pointer-events: none; }
.joystick { display: none; position: absolute; z-index: 6; left: 19px; bottom: 22px; width: 90px; height: 104px; align-items: center; justify-content: flex-end; flex-direction: column; pointer-events: auto; touch-action: none; user-select: none; }
.joystick-label { margin-bottom: 5px; color: rgba(255, 250, 224, .7); font-size: 8px; font-weight: 800; letter-spacing: .2em; text-shadow: 0 1px 2px rgba(15, 60, 35, .3); }
.joystick-base { position: relative; width: 76px; height: 76px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 235, .52); border-radius: 50%; background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.25), rgba(28, 90, 62, .24) 65%, rgba(18, 57, 48, .36)); box-shadow: inset 0 2px 12px rgba(255,255,255,.15), 0 7px 15px rgba(20, 65, 43, .2); backdrop-filter: blur(4px); }
.joystick-base::before { content: ''; position: absolute; inset: 11px; border: 1px dashed rgba(255, 251, 218, .42); border-radius: 50%; }
.joystick-knob { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; border: 2px solid rgba(255,255,245,.86); border-radius: 50%; background: linear-gradient(135deg, rgba(255, 248, 210, .84), rgba(241, 180, 78, .72)); box-shadow: 0 4px 9px rgba(21, 61, 44, .26), inset 0 1px 2px rgba(255,255,255,.75); transform: translate(-50%, -50%); transition: transform .18s ease-out; }
.floating-hit { display: none; position: absolute; z-index: 6; right: 19px; bottom: 25px; min-width: 70px; height: 52px; align-items: center; justify-content: center; gap: 7px; border: 1px solid rgba(255, 255, 236, .5); border-radius: 17px; background: rgba(28, 58, 55, .7); color: rgba(255, 251, 222, .95); box-shadow: inset 0 1px 8px rgba(255,255,255,.12), 0 7px 15px rgba(20, 65, 43, .2); backdrop-filter: blur(5px); cursor: pointer; touch-action: manipulation; }
.floating-hit span { font-size: 12px; font-weight: 800; }
.floating-hit b { color: var(--yellow); font-size: 14px; }
.floating-hit:active, .floating-hit.is-hit { transform: translateY(2px) scale(.96); background: rgba(239, 107, 73, .82); }
.turn-badge, .rally-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 99px; background: rgba(24, 39, 41, .72); color: white; font-size: 10px; font-weight: 700; backdrop-filter: blur(6px); }
.rally-badge { color: #fff5dc; background: rgba(255, 249, 231, .78); color: #776a59; }
.rally-badge b { color: var(--orange); }
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: #a7e08b; box-shadow: 0 0 0 4px rgba(167, 224, 139, .2); }
.start-card { position: absolute; z-index: 4; left: 12%; right: 12%; top: 36%; padding: 22px 24px 19px; border: 1px solid rgba(255,255,255,.48); border-radius: 22px; background: rgba(255, 249, 238, .91); box-shadow: 0 18px 42px rgba(50, 40, 22, .18); backdrop-filter: blur(7px); transition: opacity .35s, transform .35s; }
.start-card.is-hidden { opacity: 0; pointer-events: none; transform: translateY(10px); }
.start-sticker { position: absolute; right: 18px; top: -27px; width: 62px; height: 62px; display: grid; place-content: center; text-align: center; transform: rotate(8deg); border-radius: 50%; border: 3px solid var(--ink); background: var(--yellow); color: var(--ink); font-size: 11px; line-height: 1.05; font-weight: 900; box-shadow: 4px 5px 0 var(--ink); }
.start-sticker span { font-size: 16px; letter-spacing: .03em; }
.start-copy .mini-label { color: var(--orange); }
.start-copy h2 { margin: 8px 0 6px; font-size: 23px; letter-spacing: -.05em; }
.start-copy p { margin: 0; color: #7c8782; font-size: 12px; line-height: 1.7; }
.primary-button { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-top: 17px; padding: 13px 14px 13px 18px; border: 0; border-radius: 12px; cursor: pointer; color: white; background: var(--orange); font-weight: 800; box-shadow: inset 0 -3px rgba(167, 59, 37, .23); transition: transform .18s, background .18s; }
.primary-button:hover { background: var(--orange-dark); transform: translateY(-2px); }
.primary-button b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: rgba(255,255,255,.2); font-size: 17px; }
.start-hint { display: block; text-align: center; color: #9b9589; font-size: 9px; margin-top: 12px; }
.point-toast { position: absolute; z-index: 5; top: 46%; left: 50%; translate: -50% -50%; opacity: 0; pointer-events: none; text-align: center; color: white; text-shadow: 2px 3px 0 rgba(28, 85, 47, .25); transform: scale(.7) rotate(-5deg); transition: opacity .2s, transform .35s cubic-bezier(.2,1.4,.4,1); }
.point-toast.is-visible { opacity: 1; transform: scale(1) rotate(-5deg); }
.point-toast span { display: block; font-size: clamp(28px, 4vw, 46px); font-weight: 900; letter-spacing: -.08em; }
.point-toast b { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--yellow); color: #684f2a; font-size: 13px; }
.control-dock { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 7px 0; }
.mobile-move-controls { display: flex; align-items: center; gap: 8px; color: #98a39f; font-size: 10px; }
.control-button { width: 38px; height: 32px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 9px; background: #fffaf4; color: var(--ink); cursor: pointer; font-size: 17px; transition: background .15s, transform .15s; }
.control-button:active { transform: translateY(2px); background: var(--mint); }
.hit-button { position: relative; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 12px; padding: 12px 16px; background: var(--navy); color: white; cursor: pointer; font-size: 13px; font-weight: 800; box-shadow: 0 4px 0 #142b2e; transition: transform .15s; }
.hit-button:hover { transform: translateY(-2px); }
.hit-button:active, .hit-button.is-hit { transform: translateY(3px); box-shadow: none; }
.hit-button b { color: #92cab1; font-size: 9px; letter-spacing: .1em; }
.hit-ripple { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 5px rgba(243, 187, 82, .14); }
.restart-button { border: 0; color: #9a8171; background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; }
.restart-button span { font-size: 17px; vertical-align: -1px; margin-right: 4px; }

.side-panel { padding-top: 92px; display: grid; gap: 14px; }
.side-card { border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 252, 248, .42); padding: 18px; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-number { color: #c3aaa0; font-size: 11px; font-weight: 800; }
.status-card h3 { margin: 18px 0 6px; font-size: 19px; letter-spacing: -.05em; }
.status-card p { margin: 0; color: #81908c; font-size: 12px; line-height: 1.75; }
.tip-meter { margin-top: 23px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; font-size: 9px; }
.meter-label { color: #99a39f; white-space: nowrap; }
.meter { height: 5px; border-radius: 9px; background: #e6ded6; overflow: hidden; }
.meter i { display: block; width: 12%; height: 100%; background: var(--orange); border-radius: inherit; transition: width .4s; }
.tip-meter b { color: var(--orange); font-size: 9px; white-space: nowrap; }
.player-card { display: flex; align-items: center; gap: 11px; padding: 12px 14px; }
.player-avatar { position: relative; width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; color: var(--ink); font-weight: 900; font-size: 10px; overflow: hidden; }
.avatar-you { background: var(--mint); }
.avatar-bot { background: #f7c87d; }
.avatar-cap { position: absolute; top: 3px; left: 6px; right: 6px; height: 8px; background: var(--orange); border-radius: 10px 10px 3px 3px; }
.player-card > div:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.player-card strong { font-size: 13px; }
.player-card small { font-size: 10px; color: #96a19e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ready-mark, .bot-spark { margin-left: auto; font-size: 9px; font-weight: 800; color: var(--green-deep); letter-spacing: .08em; }
.bot-spark { color: var(--orange); font-size: 18px; }
.quote-card { padding: 14px 13px 2px 17px; color: #9b8b7c; }
.quote-mark { color: var(--yellow); display: block; height: 18px; font-family: Georgia, serif; font-size: 36px; line-height: .8; }
.quote-card p { font-size: 13px; line-height: 1.55; margin: 0; }
.quote-card b { color: var(--orange); }
.quote-line { width: 34px; height: 3px; background: var(--orange); display: block; margin-top: 13px; border-radius: 9px; }
.footer-note { padding: 0 2vw; display: flex; justify-content: space-between; color: #abb2ae; font-size: 9px; letter-spacing: .16em; }

@media (max-width: 1100px) {
  .app-shell { padding: 0 28px 20px; }
  .page-grid { grid-template-columns: 190px minmax(430px, 1fr); gap: 28px; }
  .side-panel { grid-column: 1 / -1; padding-top: 0; grid-template-columns: repeat(3, 1fr); }
  .quote-card { display: none; }
  .how-to { margin-top: 66px; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 14px 20px; }
  .topbar { height: 67px; }
  .brand { font-size: 11px; }
  .live-pill { display: none; }
  .page-grid { display: block; padding: 25px 0 24px; }
  .intro-panel { padding: 0 8px 22px; display: grid; grid-template-columns: 1fr auto; align-items: end; }
  .eyebrow { grid-column: 1 / -1; }
  h1 { margin: 15px 0 9px; font-size: 50px; }
  .intro-copy { font-size: 12px; line-height: 1.6; }
  .match-summary, .how-to { display: none; }
  .game-topline { padding: 3px 6px 13px; }
  .game-title small { display: none; }
  .score-strip { gap: 7px; }
  .score-side { gap: 5px; }
  .score-side b { width: 25px; height: 25px; font-size: 12px; border-radius: 8px; }
  .score-name { font-size: 10px; }
  .court-frame { border-radius: 23px; padding: 7px; box-shadow: 0 12px 0 rgba(174, 111, 57, .15), 0 14px 32px rgba(49,40,31,.13); }
  canvas { border-radius: 17px; }
  .canvas-hud { top: 17px; left: 17px; right: 17px; }
  .joystick { display: flex; }
  .floating-hit { display: flex; }
  .turn-badge, .rally-badge { font-size: 9px; padding: 6px 9px; }
  .start-card { left: 9%; right: 9%; top: 36%; padding: 19px 19px 15px; }
  .start-copy h2 { font-size: 20px; }
  .start-copy p { font-size: 11px; }
  .start-sticker { width: 54px; height: 54px; right: 12px; top: -24px; font-size: 9px; }
  .start-sticker span { font-size: 14px; }
  .control-dock { padding: 14px 2px 0; }
  .mobile-move-controls { display: none; }
  .control-dock .hit-button { display: none; }
  .control-button { width: 42px; height: 36px; }
  .hit-button { padding: 11px 14px; }
  .restart-button { font-size: 10px; }
  .side-panel { margin-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .status-card { grid-column: 1 / -1; }
  .side-card { padding: 14px; }
  .player-card { padding: 9px 11px; }
  .player-avatar { width: 32px; height: 32px; border-radius: 10px; }
  .ready-mark { font-size: 8px; }
  .footer-note { padding: 24px 5px 0; font-size: 8px; }
}
@media (max-width: 390px) {
  .intro-copy { display: none; }
  .intro-panel { padding-bottom: 18px; }
  .hit-button b { display: none; }
  .restart-button { font-size: 9px; }
}
