/* ========== UNO Card Table ========== */

.uno-title, .uno-active-title { color: #ef3340; font-weight: 900; letter-spacing: 4px; }
.uno-active-title { font-size: 24px; }
.uno-create-options { margin: 0 0 20px; }
.uno-create-options .uno-checkbox-row + .uno-checkbox-row { margin-top: 8px; }
.uno-checkbox-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #0f172a; border: 1px solid #334155; border-radius: 8px; }
.uno-checkbox-row label { display: flex; align-items: center; flex: 1; min-width: 0; gap: 10px; color: #e2e8f0; font-size: 14px; cursor: pointer; }
.uno-checkbox-row input { width: 20px; height: 20px; margin: 0; accent-color: #ef3340; flex: 0 0 auto; }
.uno-rule-info { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; padding: 0; border: 1px solid #64748b; border-radius: 50%; background: #1e293b; color: #cbd5e1; font-family: Georgia, serif; font-size: 16px; font-weight: 700; cursor: pointer; }
.uno-rule-info:hover { border-color: #e2e8f0; color: #fff; }
.uno-rule-info:focus-visible { outline: 2px solid #fbbf24; outline-offset: 3px; }
.uno-house-rule-dialog p { color: #526075; font-size: 14px; line-height: 1.6; }
.lobby-uno-config { padding: 10px 14px; margin-bottom: 12px; background: #101b2c; border: 1px solid #334155; border-radius: 8px; color: #cbd5e1; text-align: center; font-size: 13px; }
.uno-rules-content { border-color: #ef3340; }
.uno-rules-content h2 { color: #ef3340; }
.uno-rules-content h3 { color: #fbbf24; }

.uno-score-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 0 auto 8px; }
.uno-score-item { display: flex; gap: 7px; align-items: center; padding: 5px 9px; color: #9db3a2; background: #0d1a16; border: 1px solid #1d382c; border-radius: 999px; font-size: 11px; }
.uno-score-item b { color: #fff; font-size: 12px; }
.uno-score-item.me { border-color: #fbbf24; color: #fff; }
.uno-board { position: relative; width: 100%; max-width: 620px; min-height: 310px; aspect-ratio: 1.48 / 1; margin: 0 auto; border: 2px solid #286244; border-radius: 46% / 38%; background: radial-gradient(ellipse at center, #176344 0%, #10432f 58%, #09291e 100%); box-shadow: inset 0 0 0 8px rgba(3,18,12,.24), inset 0 0 32px rgba(0,0,0,.28), 0 10px 25px rgba(0,0,0,.2); overflow: hidden; user-select: none; }
.uno-board::after { content: ''; position: absolute; inset: 12px; border: 1px solid rgba(204,255,223,.13); border-radius: inherit; pointer-events: none; }
.uno-seat { position: absolute; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 3px; max-width: 132px; }
.uno-seat-top { top: 12px; left: 50%; transform: translateX(-50%); }
.uno-seat-top-left { top: 18%; left: 13%; }
.uno-seat-top-right { top: 18%; right: 13%; }
.uno-seat-left { top: 46%; left: 5%; transform: translateY(-50%); }
.uno-seat-right { top: 46%; right: 5%; transform: translateY(-50%); }
.uno-seat-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 8px; border: 1px solid transparent; border-radius: 10px; background: rgba(3,15,10,.72); color: #e2e8f0; font-size: 11px; font-weight: 700; }
.uno-seat-name span { color: #a9cbb6; font-size: 10px; font-weight: 500; }
.uno-seat.active .uno-seat-name { border-color: #fbbf24; color: #fff; box-shadow: 0 0 9px rgba(251,191,36,.35); }
.uno-opponent-hand { display: flex; min-height: 27px; justify-content: center; }
.uno-card-back { position: relative; flex: 0 0 auto; width: 25px; height: 36px; margin-left: -12px; border: 2px solid #f8fafc; border-radius: 5px; background: conic-gradient(#ef3340 0 25%, #e8c825 0 50%, #138a50 0 75%, #2463c9 0); box-shadow: 0 2px 5px rgba(0,0,0,.35); }
.uno-card-back:first-child { margin-left: 0; }
.uno-card-back::after { content: ''; position: absolute; inset: 4px 5px; border: 1px solid rgba(255,255,255,.85); border-radius: 50%; transform: rotate(-28deg); }
.uno-catch-btn { border: 1px solid #fbbf24; border-radius: 6px; padding: 3px 7px; background: #402f08; color: #fde68a; font-size: 10px; font-weight: 800; cursor: pointer; }

.uno-center { position: absolute; top: 50%; left: 50%; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 7px; transform: translate(-50%, -50%); }
.uno-piles { display: flex; align-items: center; gap: 16px; }
.uno-pile-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #c3decc; font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.uno-draw-pile { width: 58px; height: 84px; margin: 0; cursor: pointer; }
.uno-draw-pile:disabled { opacity: .72; cursor: default; }
.uno-card { --uno-color: #ef3340; position: relative; display: flex; flex: 0 0 auto; flex-direction: column; align-items: center; justify-content: center; width: 58px; height: 84px; padding: 4px; overflow: hidden; border: 2px solid #f8fafc; border-radius: 9px; background: var(--uno-color); color: #fff; box-shadow: 0 3px 7px rgba(0,0,0,.3); font: inherit; cursor: default; }
.uno-card-red { --uno-color: #ef3340; }
.uno-card-yellow { --uno-color: #e3c922; color: #13221a; }
.uno-card-green { --uno-color: #139451; }
.uno-card-blue { --uno-color: #245bc5; }
.uno-card-wild { --uno-color: #23252b; background: conic-gradient(#ef3340 0 25%, #e3c922 0 50%, #139451 0 75%, #245bc5 0); }
.uno-card-oval { position: absolute; width: 52px; height: 71px; border-radius: 50%; background: #fff; transform: rotate(28deg); }
.uno-card-wild .uno-card-oval { background: #20242b; border: 1px solid rgba(255,255,255,.85); }
.uno-card-face { position: relative; z-index: 1; max-width: 100%; text-align: center; color: var(--uno-color); font-size: 22px; font-weight: 1000; line-height: 1; text-shadow: 0 1px 0 rgba(0,0,0,.12); }
.uno-card-yellow .uno-card-face { color: #947c00; }
.uno-card-wild .uno-card-face { color: #fff; font-size: 13px; }
.uno-corner { position: absolute; z-index: 2; left: 4px; color: #fff; font-size: 9px; font-weight: 900; line-height: 1; }
.uno-card-yellow .uno-corner { color: #18210d; }
.uno-corner.top { top: 4px; }
.uno-corner.bottom { right: 4px; bottom: 4px; left: auto; transform: rotate(180deg); }
.uno-card.playable { cursor: pointer; transition: transform .14s, box-shadow .14s; }
.uno-card.playable:hover { transform: translateY(-7px); box-shadow: 0 8px 14px rgba(0,0,0,.4); }
.uno-card.selected { transform: translateY(-11px); box-shadow: 0 0 0 3px #fbbf24, 0 8px 18px rgba(0,0,0,.4); }
.uno-current-color { display: flex; align-items: center; gap: 5px; color: #e2e8f0; font-size: 11px; font-weight: 700; }
.uno-swatch { width: 12px; height: 12px; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; background: #475569; }
.uno-swatch.red, .uno-color-choice.uno-red { background: #ef3340; }
.uno-swatch.yellow, .uno-color-choice.uno-yellow { background: #e3c922; }
.uno-swatch.green, .uno-color-choice.uno-green { background: #139451; }
.uno-swatch.blue, .uno-color-choice.uno-blue { background: #245bc5; }
.uno-swatch.wild { background: conic-gradient(#ef3340 0 25%, #e3c922 0 50%, #139451 0 75%, #245bc5 0); }
.uno-pending-draw { color: #fee2e2; font-size: 13px; font-weight: 900; }

.uno-my-hand-label { margin: 9px 0 5px; color: #94a3b8; text-align: center; font-size: 12px; font-weight: 700; }
.uno-my-hand-label.active { color: #fbbf24; }
.uno-hand { display: flex; justify-content: flex-start; gap: 0; max-width: 100%; min-height: 100px; padding: 8px 14px 14px; overflow-x: auto; overscroll-behavior-x: contain; }
.uno-hand .uno-card { width: 58px; height: 84px; margin-left: -10px; }
.uno-hand .uno-card:first-child { margin-left: auto; }
.uno-hand .uno-card:last-child { margin-right: auto; }
.uno-last-action { margin: 0 0 6px; color: #94a3b8; text-align: center; font-size: 12px; }
.uno-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 12px; }
.uno-action-btn { min-height: 42px; padding: 9px 17px; border: 1px solid #475569; border-radius: 8px; background: #1e293b; color: #f8fafc; font-weight: 800; cursor: pointer; }
.uno-action-btn:disabled { opacity: .45; cursor: not-allowed; }
.uno-action-red { border-color: #f87171; background: #b91c1c; }
.uno-action-blue { border-color: #60a5fa; background: #1d4ed8; }
.uno-action-green { border-color: #4ade80; background: #15803d; }
.uno-action-yellow { border-color: #facc15; background: #a16207; }
.uno-color-prompt { display: grid; justify-items: center; gap: 8px; width: 100%; color: #e2e8f0; font-size: 13px; font-weight: 700; }
.uno-color-choices { display: flex; gap: 10px; justify-content: center; }
.uno-color-choice { width: 38px; height: 38px; border: 2px solid #fff; border-radius: 50%; cursor: pointer; box-shadow: 0 2px 7px rgba(0,0,0,.35); }
.uno-color-choice:hover { outline: 3px solid #fbbf24; }
.uno-waiting { padding: 14px; color: #94a3b8; text-align: center; }
.uno-result { padding: 16px; margin: 8px 0 16px; border: 1px solid #334155; border-radius: 10px; background: #0f172a; text-align: center; }
.uno-result h2 { color: #f8fafc; font-size: 19px; }
.uno-result p { color: #94a3b8; margin: 8px 0; }

@media (max-width: 520px) {
  .uno-board { min-height: 285px; aspect-ratio: 1.12 / 1; border-radius: 28% / 22%; }
  .uno-board::after { inset: 8px; }
  .uno-seat-top-left { top: 18%; left: 7%; }
  .uno-seat-top-right { top: 18%; right: 7%; }
  .uno-seat-left { left: 3%; }
  .uno-seat-right { right: 3%; }
  .uno-seat-name { max-width: 94px; padding: 3px 5px; font-size: 10px; }
  .uno-opponent-hand { transform: scale(.88); transform-origin: top center; }
  .uno-piles { gap: 9px; }
  .uno-card, .uno-draw-pile { width: 49px; height: 72px; }
  .uno-card-oval { width: 44px; height: 60px; }
  .uno-card-face { font-size: 18px; }
  .uno-card-wild .uno-card-face { font-size: 11px; }
  .uno-hand { justify-content: flex-start; padding-right: 18px; padding-left: 18px; }
  .uno-hand .uno-card:first-child { margin-left: 0; }
  .uno-action-btn { flex: 1 1 42%; }
}

/* Dark, card-first UNO layout */
#uno-active {
  color-scheme: dark;
  min-height: 100dvh;
  margin: -48px -16px 0;
  padding: 12px 14px 22px;
  background: #071329;
  color: #edf0f5;
}
#uno-active .header-bar { border-color: #263c5c; }
#uno-active .phase-text { color: #aab3c0; }
#uno-active .tab { background: #132642; color: #b8c1ce; }
#uno-active .tab.active { background: #244777; color: #e0edff; }
#uno-active .tab-exit { background: #ef3340; }
#uno-active .uno-active-title { color: #ef3340; }
.uno-card-table { width: min(100%, 760px); margin: 0 auto; }
.uno-opponents-row { display: flex; align-items: flex-start; justify-content: center; gap: 12px; min-height: 86px; padding: 5px 0 12px; overflow-x: auto; }
.uno-opponent { display: grid; justify-items: center; align-content: start; gap: 3px; flex: 0 0 72px; min-width: 62px; padding: 3px 4px 6px; border: 1px solid transparent; border-radius: 12px; text-align: center; }
.uno-opponent.active { border-color: #fbbf24; background: #30291c; }
.uno-avatar { display: grid; place-items: center; width: 40px; height: 40px; border: 2px solid #566171; border-radius: 50%; background: #252b34; color: #edf0f5; font-size: 13px; font-weight: 900; }
.uno-avatar-red { border-color: #ee6575; background: #49212a; color: #ffb5bf; }
.uno-avatar-yellow { border-color: #e8c12e; background: #3e3317; color: #ffe28a; }
.uno-avatar-green { border-color: #30a86c; background: #193a2b; color: #89e5b4; }
.uno-avatar-blue { border-color: #5592ed; background: #1c304b; color: #b3d2ff; }
.uno-avatar-self { border-color: #ee6575; background: #49212a; color: #ffb5bf; }
.uno-opponent-name { max-width: 72px; overflow: hidden; color: #edf0f5; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.uno-opponent-meta { color: #aab3c0; font-size: 9px; white-space: nowrap; }
.uno-catch-btn { padding: 3px 5px; border-color: #f1cb4d; background: #3e3317; color: #ffe28a; font-size: 9px; }
.uno-table-center { display: flex; flex-direction: column; align-items: center; gap: 13px; padding: 12px 8px 18px; }
.uno-card-stacks { display: flex; align-items: center; justify-content: center; gap: 30px; min-height: 150px; }
.uno-card-stack { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.uno-pile-caption { color: #9aa4b3; font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.uno-draw-pile { width: 64px; height: 94px; border-color: #d7dce3; cursor: pointer; }
.uno-draw-pile:disabled { opacity: .7; cursor: default; }
.uno-card { width: 66px; height: 96px; border: 2px solid #d3d9e0; border-radius: 9px; box-shadow: 0 2px 5px rgba(25,37,55,.12); }
.uno-card-oval { width: 58px; height: 79px; }
.uno-card-face { font-size: 23px; }
.uno-card-wild .uno-card-face { font-size: 12px; }
.uno-corner { font-size: 9px; }
.uno-turn-banner { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; width: min(100%, 440px); padding: 8px 12px; border-radius: 8px; background: #132642; color: #b8c1ce; font-size: 12px; }
.uno-turn-banner span { color: #c5cdd9; }
.uno-turn-banner b { color: #fbbf24; font-size: 14px; }
.uno-turn-banner.my-turn { background: #1b3559; }
.uno-pending-draw { color: #c62837; }
.uno-my-hand-header { display: flex; align-items: center; gap: 9px; width: min(100%, 580px); margin: 2px auto 5px; padding: 8px 10px; border-radius: 8px; background: #132642; }
.uno-my-hand-header .uno-avatar { width: 34px; height: 34px; flex: 0 0 auto; }
.uno-my-hand-header > div:last-child { display: grid; gap: 2px; min-width: 0; color: #edf0f5; font-size: 12px; }
.uno-my-hand-header span { color: #aab3c0; font-size: 10px; }
.uno-hand { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); justify-items: center; align-items: start; gap: 9px 7px; width: min(100%, 580px); min-height: 0; margin: 0 auto; padding: 7px 2px 12px; overflow: visible; }
.uno-hand .uno-card { width: 100%; max-width: 68px; height: auto; aspect-ratio: 2 / 3; margin: 0; padding: 3px; }
.uno-hand .uno-card-oval { width: 84%; height: 82%; }
.uno-hand .uno-card-face { font-size: clamp(15px, 4vw, 21px); }
.uno-hand .uno-card-wild .uno-card-face { font-size: 10px; }
.uno-hand .uno-corner { left: 3px; font-size: 8px; }
.uno-hand .uno-corner.bottom { right: 3px; left: auto; }
.uno-card.disabled { opacity: .93; }
.uno-last-action { color: #aab3c0; }
.uno-action-btn { border-color: #405d83; background: #132642; color: #edf0f5; }
.uno-action-red { border-color: #ef3340; background: #ef3340; color: #fff; }
.uno-action-blue { border-color: #3e7ad4; background: #2256a3; color: #fff; }
.uno-action-green { border-color: #15834c; background: #15834c; color: #fff; }
.uno-action-yellow { border-color: #e3b81c; background: #f6d95c; color: #332b0a; }
.uno-waiting { color: #aab3c0; }
.uno-result { border-color: #263c5c; background: #132642; }
.uno-result h2 { color: #edf0f5; }

@media (max-width: 520px) {
  #uno-active { margin-right: -14px; margin-left: -14px; padding-right: 10px; padding-left: 10px; }
  .uno-opponents-row { justify-content: flex-start; gap: 6px; min-height: 78px; }
  .uno-opponent { flex-basis: 66px; min-width: 58px; }
  .uno-card-stacks { gap: 24px; min-height: 136px; }
  .uno-card-stack > .uno-card { width: 59px; height: 86px; }
  .uno-card-stack > .uno-draw-pile { width: 57px; height: 84px; }
  .uno-hand { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px 6px; }
  .uno-action-btn { flex: 0 1 auto; }
}
