.mode-picker[hidden], .remote-setup[hidden], .ludo-app[hidden], .signal-panel[hidden], [hidden] { display: none !important; }
.mode-picker { padding: 22px 0 50px; }
.mode-picker > h1, .remote-setup > h1 { margin: 12px 0 0; font: 700 clamp(43px, 6vw, 67px)/.98 var(--display); letter-spacing: -.08em; }
.mode-picker > h1 span, .remote-setup > h1 span { color: var(--lime); }
.mode-intro { margin: 12px 0 23px; color: #b1adbc; font-size: 12px; }
.mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.mode-card { overflow: hidden; border: 1px solid #ffffff1b; border-radius: 13px; background: #211f30; }
.mode-visual { height: 173px; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.local-visual { background: linear-gradient(145deg, #f5b379, #ef8d7b); }
.remote-visual { background: linear-gradient(145deg, #8172f4, #5348ce); }
.demo-phone { position: relative; width: 99px; height: 143px; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 14px 10px; border: 4px solid #292638; border-radius: 17px; background: #fdf9f1; box-shadow: 0 12px 25px #31233b3d; }
.demo-phone-title { color: #353046; font: 700 9px var(--mono); letter-spacing: .1em; }
.demo-token { width: 23px; height: 23px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 2px 5px #25203940; }
.demo-token-red { background: #e96870; animation: turn-token 2.8s ease-in-out infinite; }
.demo-token-yellow { background: #e9bd4d; animation: turn-token 2.8s ease-in-out 1.4s infinite; }
.demo-pass { margin-top: auto; color: #655c6b; font: 6px var(--mono); letter-spacing: .04em; }
.demo-pass b { margin-left: 4px; color: #6b5de6; }
.visual-spark { position: absolute; top: 27px; right: calc(50% - 78px); color: #fff2b4; font-size: 25px; animation: spark-pop 2.2s ease-in-out infinite; }
.phone-left { margin-right: 55px; transform: rotate(-7deg); }.phone-right { margin-left: -7px; transform: rotate(7deg); }
.phone-left .demo-token { background: #ed7780; }.phone-right .demo-token { background: #718bea; }
.peer-beam { position: absolute; left: calc(50% - 42px); top: 77px; width: 84px; height: 2px; background: #d9f4a0; box-shadow: 0 0 13px #d9f4a0aa; }
.peer-beam::after { position: absolute; top: -4px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: #efffc4; box-shadow: 0 0 12px #efffc4; content: ""; animation: code-travel 1.8s ease-in-out infinite alternate; }
.peer-code { position: absolute; top: 117px; left: 0; right: 0; color: #fff; text-align: center; font: 7px var(--mono); letter-spacing: .1em; }
@keyframes turn-token { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes spark-pop { 0%, 100% { transform: scale(.8) rotate(-8deg); opacity: .65; } 50% { transform: scale(1.15) rotate(12deg); opacity: 1; } }
@keyframes code-travel { to { left: 74px; } }
.mode-copy { padding: 18px 20px 20px; }
.mode-kicker { margin: 0 0 8px; color: #a6a2b3; font: 8px var(--mono); letter-spacing: .09em; }
.mode-copy h2 { margin: 0; font: 700 24px var(--display); letter-spacing: -.06em; }
.mode-copy > p:not(.mode-kicker) { min-height: 36px; margin: 7px 0 12px; color: #b1adbc; font-size: 11px; line-height: 1.6; }
.mode-copy .mode-detail { min-height: 0 !important; margin: 0 0 14px !important; color: var(--lime) !important; font-size: 9px !important; }
.mode-button { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.mode-footnote { max-width: 700px; margin: 15px 0 0; color: #8e8b9c; font-size: 9px; line-height: 1.6; }
.remote-setup { padding: 8px 0 55px; }
.mode-back { margin-bottom: 26px; padding: 0; border: 0; background: none; color: #c5c1d0; cursor: pointer; font-size: 11px; }
.mode-back span { margin-right: 6px; color: var(--lime); }
.remote-setup > h1 { margin-top: 10px; }
.connection-steps { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 12px; margin: 22px 0 13px; padding: 16px; border: 1px solid #ffffff1b; border-radius: 10px; background: #211f30; }
.connection-steps > div { display: grid; gap: 7px; }
.connection-steps > div span { color: var(--lime); font: 9px var(--mono); }
.connection-steps > div b { color: #e8e5ed; font-size: 10px; font-weight: 600; }
.connection-steps > i { color: var(--violet); font-style: normal; animation: step-arrow 1.3s ease-in-out infinite alternate; }
@keyframes step-arrow { to { transform: translateX(4px); color: var(--lime); } }
.remote-note { max-width: 760px; margin: 0 0 17px; color: #aaa7b6; font-size: 10px; line-height: 1.6; }
.remote-roles { display: flex; gap: 9px; margin-bottom: 15px; }
.role-button { min-width: 170px; display: flex; justify-content: space-between; gap: 18px; }
.role-secondary { border: 1px solid #ffffff35; background: transparent; color: var(--paper); }
.role-secondary:hover { background: #ffffff12; }
.signal-panel { display: grid; gap: 10px; max-width: 680px; padding: 19px; border: 1px solid #ffffff1c; border-radius: 11px; background: #211f30; }
.signal-panel h2 { margin: 0; font: 600 18px var(--display); }
.signal-panel > p { margin: -4px 0 6px; color: #aaa7b6; font-size: 10px; line-height: 1.55; }
.signal-panel label { margin-top: 3px; color: #a8a4b4; font: 8px var(--mono); letter-spacing: .1em; }
.signal-panel textarea { width: 100%; min-height: 72px; resize: vertical; padding: 10px; border: 1px solid #ffffff22; border-radius: 7px; background: #171522; color: #e6e1f7; font: 9px/1.5 var(--mono); overflow-wrap: anywhere; }
.signal-panel textarea::placeholder { color: #777386; }
.signal-panel input[type="url"], .signal-panel input[type="text"] { width: 100%; min-height: 44px; padding: 9px; border: 1px solid #ffffff22; border-radius: 7px; background: #171522; color: #e6e1f7; font: 10px/1.45 var(--mono); }
.signal-panel > .game-button { justify-self: start; }
.signal-panel > .game-button:disabled { opacity: .45; cursor: not-allowed; }
.copy-button { justify-self: start; padding: 7px 11px; border: 1px solid #c7f47777; border-radius: 20px; background: transparent; color: var(--lime); cursor: pointer; font-size: 10px; }
.copy-button:hover { background: #c7f47718; }
.scan-code-button { justify-self: start; min-height: 42px; padding: 0 14px; border: 1px solid #ffffff35; border-radius: 24px; background: transparent; color: #e5e1ed; cursor: pointer; font-size: 11px; }
.scan-code-button:hover { border-color: var(--lime); color: var(--lime); }
.invite-share { display: grid; justify-items: start; gap: 9px; padding: 14px; border: 1px solid #c7f47735; border-radius: 9px; background: #171522; }
.invite-share h3 { margin: 0; font: 600 15px var(--display); }
.invite-share > p { margin: 0; color: #aaa7b6; font-size: 10px; line-height: 1.5; }
.invite-share label { margin-top: 4px; }
.qr-code { width: min(100%, 230px); aspect-ratio: 1; display: grid; place-items: center; justify-self: center; padding: 9px; border-radius: 8px; background: white; }
.qr-code:empty { display: none; }
.qr-code svg { width: 100%; height: 100%; }
.qr-scanner { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: #090812d9; }
.qr-scanner[hidden] { display: none; }
.scanner-card { width: min(100%, 450px); display: grid; gap: 12px; padding: 17px; border: 1px solid #ffffff2c; border-radius: 14px; background: #211f30; box-shadow: 0 20px 70px #0009; }
.scanner-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scanner-heading h2 { margin: 0; font: 600 18px var(--display); }
.scanner-close { width: 44px; height: 44px; border: 1px solid #ffffff35; border-radius: 50%; background: transparent; color: var(--paper); cursor: pointer; font-size: 26px; }
.scanner-card video { width: 100%; max-height: min(58vh, 430px); aspect-ratio: 4 / 3; border-radius: 8px; background: #080711; object-fit: cover; }
.scanner-card > p { margin: 0; color: #c6c2d1; font-size: 12px; line-height: 1.5; }
.connection-status { min-height: 18px; margin: 12px 0 0; color: var(--lime); font-size: 10px; }
.connection-status.is-error { color: #ff9e9a; }
.ludo-app { padding-bottom: 10px; }
.ludo-main { width: min(1200px, calc(100% - 56px)); margin: 0 auto; padding: 28px 0 60px; }
.ludo-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin: 21px 0 17px; }
.ludo-heading h1 { margin: 0; font: 700 clamp(39px, 5vw, 60px)/1.02 var(--display); letter-spacing: -.075em; }
.ludo-heading h1 span { display: block; margin-top: 4px; color: var(--lime); font-size: .56em; letter-spacing: -.04em; }
.ludo-intro { max-width: 540px; margin: 12px 0 0; color: #b1adbc; font-size: 13px; line-height: 1.6; }
.ludo-new-game { display: flex; flex-shrink: 0; align-items: center; gap: 9px; }
.ludo-new-game label { color: #a8a4b4; font: 8px var(--mono); letter-spacing: .1em; }
.ludo-new-game select { height: 44px; padding: 0 28px 0 12px; border: 1px solid #ffffff27; border-radius: 7px; background: #211f30; color: var(--paper); font-size: 11px; }
.ludo-new-game .game-button { min-height: 44px; padding-inline: 16px; }
.mode-link-button { padding: 8px 10px; border: 1px solid #ffffff2b; border-radius: 22px; background: transparent; color: #d1ced9; cursor: pointer; font-size: 9px; }
.mode-link-button:hover { border-color: var(--lime); color: var(--lime); }
.ludo-app + .game-tools { margin: 0 0 15px; }
.storage-status { min-height: 19px; margin: 0 0 12px; color: #b1adbc; font-size: 10px; }
.network-status { min-height: 18px; margin: -8px 0 12px; color: var(--lime); font-size: 10px; }
.ludo-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); align-items: start; gap: 22px; }
.board-frame { padding: 11px; border: 1px solid #ffffff1c; border-radius: 13px; background: #f8f5ee; box-shadow: 0 18px 45px #08071145; }
.ludo-board-grid { position: relative; display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); grid-template-rows: repeat(15, minmax(0, 1fr)); width: 100%; aspect-ratio: 1; overflow: hidden; border: 1px solid #d7d1c5; background: #fffdf8; }
.board-cell { position: relative; display: flex; min-width: 0; min-height: 0; align-items: center; justify-content: center; border: 1px solid #e7e2d9; background: #fffdf8; }
.board-cell.is-empty { border-color: transparent; background: transparent; }
.board-cell.is-track { background: #fffefb; }
.board-cell.is-track { border-color: #d8d2c8; }
.board-cell.is-safe::after { content: "\2726"; position: absolute; color: #8c8498; font-size: clamp(7px, 1.1vw, 13px); pointer-events: none; }
.board-cell.is-start.start-red { background: #ffdddd; }.board-cell.is-start.start-green { background: #d9f4e7; }.board-cell.is-start.start-yellow { background: #fff1bd; }.board-cell.is-start.start-blue { background: #dee7ff; }
.home-base { position: absolute; z-index: 1; display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); place-items: center; padding: 9%; border: 1px solid #ffffffaa; border-radius: 10px; box-shadow: inset 0 0 0 5px #ffffff35; }
.home-base.base-red { background: #f17c80; }.home-base.base-green { background: #59be98; }.home-base.base-yellow { background: #edbd47; }.home-base.base-blue { background: #6f8de8; }
.base-slot { width: 72%; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid #ffffffa6; border-radius: 4px; background: #fffdf2; box-shadow: 0 2px 5px #39304430; }
.home-lane.lane-red { background: #ffc0c0; }.home-lane.lane-green { background: #b8ead4; }.home-lane.lane-yellow { background: #ffe69b; }.home-lane.lane-blue { background: #c1d0ff; }
.board-cell.center-red { background: #ef777d; }.board-cell.center-green { background: #57bd96; }.board-cell.center-yellow { background: #ecc14b; }.board-cell.center-blue { background: #718bea; }
.board-cell.center-core { border: 0; background: conic-gradient(from 45deg, #57bd96 0 25%, #ecc14b 0 50%, #718bea 0 75%, #ef777d 0); }
.board-cell.center-core::after { content: "✳"; color: #fffdf2; font-size: clamp(13px, 2.1vw, 25px); }
.token-piece { position: relative; z-index: 2; width: 78%; height: 78%; min-width: 10px; min-height: 10px; display: grid; place-items: center; padding: 0; border: 1px solid #fff; border-radius: 50%; color: #fff; cursor: default; font: 700 clamp(6px, .8vw, 10px) var(--body); box-shadow: 0 2px 4px #211c2c55; }
.token-piece.token-red { background: #d64b58; }.token-piece.token-green { background: #278e6b; }.token-piece.token-yellow { background: #bf8e13; }.token-piece.token-blue { background: #405fc6; }
.token-piece.is-selectable { cursor: pointer; animation: token-pulse 1.1s ease-in-out infinite alternate; outline: 2px solid #251f37; outline-offset: 1px; }
.token-piece.is-selectable:hover { transform: scale(1.12); }
@keyframes token-pulse { to { box-shadow: 0 0 0 4px #7869f488, 0 2px 4px #211c2c55; } }
.ludo-sidebar { display: grid; gap: 13px; }
.turn-card, .player-list, .ludo-rules { padding: 17px; border: 1px solid #ffffff1b; border-radius: 11px; background: #211f30; }
.turn-card .play-eyebrow { margin-bottom: 8px; }
.turn-card h2 { margin: 0; font: 700 25px var(--display); letter-spacing: -.05em; }
.turn-card > p:not(.play-eyebrow) { min-height: 34px; margin: 7px 0 14px; color: #b1adbc; font-size: 11px; line-height: 1.5; }
.dice-row { display: flex; align-items: center; gap: 14px; }
.dice-face { width: 76px; height: 76px; flex: 0 0 76px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 3px; padding: 10px; border: 1px solid #d7d1c5; border-radius: 13px; background: #fffdf8; color: #282440; box-shadow: 0 6px 14px #08071132, inset 0 0 0 3px #ffffff; }
.dice-face.is-empty { display: grid; place-items: center; background: #171522; color: var(--lime); font: 700 30px var(--display); }
.dice-pip { display: grid; place-items: center; }
.dice-pip::after { width: 11px; aspect-ratio: 1; border-radius: 50%; background: currentColor; box-shadow: inset 0 1px 2px #00000020; content: ""; }
.dice-face.is-rolling { animation: dice-tumble .16s ease-in-out infinite alternate; }
@keyframes dice-tumble { to { transform: rotate(12deg) scale(.92); box-shadow: 0 1px 5px #08071132, inset 0 0 0 3px #ffffff; } }
.roll-button { flex: 1; }
.roll-button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.ludo-new-game .game-button:disabled { cursor: not-allowed; opacity: .45; }
.player-list h2, .ludo-rules h2 { margin: 0 0 11px; font: 600 15px var(--display); }
.player-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; min-height: 34px; border-top: 1px solid #ffffff12; color: #c8c5d1; font-size: 10px; }
.player-row.is-active { color: #fff; font-weight: 700; }
.player-dot { width: 9px; height: 9px; border-radius: 50%; }.player-dot.red { background: #f17c80; }.player-dot.green { background: #59be98; }.player-dot.yellow { background: #edc34f; }.player-dot.blue { background: #7893f1; }
.player-score { color: #9c98aa; font: 9px var(--mono); }
.ludo-rules ul { display: grid; gap: 8px; margin: 0; padding-left: 16px; color: #b1adbc; font-size: 10px; line-height: 1.55; }
.ludo-rules strong { color: var(--lime); }
.save-note { margin: 0; color: #8e8b9c; font-size: 9px; }.save-note span { margin-right: 5px; color: var(--lime); }
.ludo-footer { display: flex; justify-content: center; gap: 8px; padding-top: 35px; color: #8e8b9c; font: 8px var(--mono); letter-spacing: .1em; }.ludo-footer span { color: var(--lime); }
@media (max-width: 900px) {
  .mode-picker { padding-top: 12px; }
  .mode-visual { height: 150px; }
  .mode-copy { padding: 16px; }
  .mode-copy h2 { font-size: 21px; }
  .ludo-main { width: min(680px, calc(100% - 40px)); }
  .ludo-heading { align-items: flex-start; flex-direction: column; }
  .ludo-layout { grid-template-columns: 1fr; }
  .ludo-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .turn-card { grid-column: 1 / -1; }
  .save-note { align-self: center; }
}
@media (max-width: 520px) {
  .mode-picker { padding-top: 8px; padding-bottom: 36px; }
  .mode-picker > h1, .remote-setup > h1 { font-size: 47px; }
  .mode-intro { max-width: 320px; font-size: 11px; line-height: 1.55; }
  .mode-options { grid-template-columns: 1fr; gap: 12px; }
  .mode-card { display: flex; flex-direction: column; }
  .mode-visual { height: 112px; min-height: 112px; }
  .demo-phone { transform: scale(.68); }
  .phone-left { margin-right: 28px; transform: scale(.65) rotate(-7deg); }
  .phone-right { margin-left: -10px; transform: scale(.65) rotate(7deg); }
  .peer-beam { left: calc(50% - 38px); width: 76px; }
  .peer-code { top: auto; bottom: 25px; font-size: 6px; }
  .visual-spark { right: 12%; }
  .mode-copy { padding: 15px 13px; }
  .mode-copy h2 { font-size: 19px; }
  .mode-copy > p:not(.mode-kicker) { min-height: 0; font-size: 10px; }
  .mode-copy .mode-detail { font-size: 8px !important; }
  .mode-button { min-height: 42px; padding-inline: 12px; font-size: 10px; }
  .connection-steps { grid-template-columns: 1fr; gap: 8px; padding: 13px; }
  .connection-steps > div { grid-template-columns: 24px 1fr; align-items: center; gap: 5px; }
  .connection-steps > i { margin-left: 5px; transform: rotate(90deg); justify-self: start; }
  .remote-roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .role-button { width: 100%; min-width: 0; align-items: center; justify-content: center; gap: 5px; padding-inline: 10px; font-size: 12px; white-space: nowrap; }
  .signal-panel { padding: 14px; }
  .signal-panel textarea, .signal-panel input[type="url"], .signal-panel input[type="text"] { min-height: 94px; font-size: 16px; }
  .signal-panel > .game-button, .copy-button, .scan-code-button { min-height: 44px; }
  .invite-share { width: 100%; }
  .qr-code { width: min(100%, 250px); }
  .ludo-main { width: calc(100% - 28px); padding-top: 20px; }
  .ludo-heading h1 { font-size: 42px; }
  .ludo-heading h1 span { font-size: .56em; }
  .ludo-intro { font-size: 11px; }
  .ludo-new-game { width: 100%; gap: 7px; }
  .ludo-new-game select { flex: 1; min-width: 0; padding-inline: 8px; }
  .ludo-new-game .game-button { padding-inline: 11px; font-size: 11px; }
  .ludo-new-game .mode-link-button { min-height: 44px; padding-inline: 8px; }
  .board-frame { padding: 5px; border-radius: 8px; }
  .home-base { padding: 7%; border-radius: 5px; box-shadow: inset 0 0 0 2px #ffffff35; }
  .token-piece { min-width: 7px; min-height: 7px; border-width: 1px; }
  .ludo-sidebar { grid-template-columns: 1fr; }
  .ludo-layout { display: flex; flex-direction: column; align-items: stretch; }
  .board-frame { order: 1; width: 100%; }
  .ludo-board-grid { width: 100%; max-width: 100%; }
  .ludo-sidebar { display: contents; }
  .turn-card { order: 0; }
  .player-list { order: 2; }
  .ludo-rules { order: 3; }
  .save-note { order: 4; }
}
@media (max-width: 360px) {
  .ludo-new-game { flex-wrap: wrap; }
  .ludo-new-game label { width: 100%; }
  .ludo-new-game select { min-height: 44px; }
  .ludo-new-game .game-button { flex: 1; }
  .ludo-new-game .mode-link-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .token-piece.is-selectable { animation: none; } }
@media (prefers-reduced-motion: reduce) {
  .demo-token, .visual-spark, .peer-beam::after, .connection-steps > i { animation: none; }
  .dice-face.is-rolling { animation: none; }
}

.signal-panel input[type="text"] { font-size: 16px; letter-spacing: .12em; text-transform: uppercase; }
.signal-panel .player-list { display: grid; gap: 6px; }
#online-status.is-error { color: #ff9e9a; }
