:root {
  --ink: #17251f;
  --muted: #66756c;
  --cream: #f7f0dd;
  --paper: #fffdf4;
  --felt: #0e7750;
  --felt-dark: #07573b;
  --felt-light: #3aa675;
  --red: #ed3f43;
  --yellow: #f5c628;
  --green: #21a866;
  --blue: #3283e8;
  --orange: #f07d2f;
  --shadow: 0 18px 55px rgba(16, 39, 30, .18);
  --soft-shadow: 0 8px 20px rgba(27, 45, 37, .16);
  --display: "STKaiti", "KaiTi", "FangSong", serif;
  --body: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  background: #e7eddf;
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(245, 198, 40, .72);
  outline-offset: 3px;
}

.hidden { display: none !important; }
.view { min-height: 100dvh; position: relative; }

.noise {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: .032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}

.button {
  border: 0;
  border-radius: 13px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.03); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button-small { padding: 9px 14px; font-size: 14px; }
.button-large { width: 100%; padding: 17px 22px; font-size: 18px; }
.button-wide { width: 100%; }
.button-icon { font-size: 24px; line-height: 0; margin-right: 8px; vertical-align: -2px; }
.button-primary { background: var(--yellow); color: #28200a; box-shadow: 0 6px 0 #bd9010, 0 12px 25px rgba(166, 119, 0, .2); }
.button-primary:active:not(:disabled) { box-shadow: 0 2px 0 #bd9010, 0 6px 12px rgba(166, 119, 0, .2); }
.button-dark { background: var(--ink); color: #fffdf4; box-shadow: 0 5px 0 #07100c; }
.button-paper { background: rgba(255, 253, 244, .9); border: 1px solid rgba(23, 37, 31, .11); box-shadow: var(--soft-shadow); }
.button-ghost { color: white; border: 1px solid rgba(255,255,255,.32); background: rgba(5, 49, 34, .34); backdrop-filter: blur(10px); }
.button-danger { color: white; background: var(--red); box-shadow: 0 5px 0 #9e2027; }
.button-start { background: var(--red); color: white; box-shadow: 0 6px 0 #a51f27, 0 14px 28px rgba(174, 26, 34, .25); font-size: 17px; }

.paper-card {
  background: var(--paper);
  border: 1px solid rgba(70, 58, 31, .1);
  box-shadow: var(--shadow);
}

.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 11px; letter-spacing: .16em; font-weight: 900; }

.home-view {
  padding: 30px clamp(18px, 6vw, 90px) 35px;
  background:
    radial-gradient(circle at 12% 20%, rgba(245,198,40,.18) 0 100px, transparent 101px),
    radial-gradient(circle at 87% 78%, rgba(50,131,232,.12) 0 130px, transparent 131px),
    linear-gradient(135deg, #edf2e5, #e5ecd9);
  overflow: hidden;
}

.home-view::before, .home-view::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 230px;
  border: 3px solid rgba(23, 37, 31, .08);
  border-radius: 20px;
  transform: rotate(24deg);
}
.home-view::before { left: -75px; top: 34%; }
.home-view::after { right: -70px; top: 15%; transform: rotate(-19deg); }

.home-topbar, .room-header, .game-header {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.online-pill {
  background: rgba(255,255,255,.5);
  border: 1px solid rgba(23,37,31,.08);
  border-radius: 99px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.online-pill i { display: inline-block; width: 8px; height: 8px; background: #23b26d; border-radius: 50%; margin-right: 7px; box-shadow: 0 0 0 4px rgba(35,178,109,.12); }

.home-stage { position: relative; z-index: 2; width: min(94vw, 610px); margin: clamp(42px, 7vh, 75px) auto 70px; }
.brand-lockup { text-align: center; margin-bottom: 26px; }
.brand-kicker { margin: 10px 0 -2px; color: var(--muted); font-weight: 800; letter-spacing: .16em; font-size: 11px; }
.brand-lockup h1 { margin: 0; font-family: Georgia, serif; font-style: italic; font-size: clamp(74px, 13vw, 118px); line-height: .9; letter-spacing: -.12em; transform: skew(-7deg); text-shadow: 0 7px 0 white, 0 11px 0 rgba(23,37,31,.16); }
.brand-lockup h1 span:nth-child(1) { color: var(--red); }
.brand-lockup h1 span:nth-child(2) { color: var(--yellow); }
.brand-lockup h1 span:nth-child(3) { color: var(--blue); }
.brand-subtitle { margin: 16px 0 0; font-family: var(--display); font-size: 18px; }
.brand-cards { height: 26px; display: flex; justify-content: center; }
.mini-card { width: 20px; height: 29px; border-radius: 3px; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,.18); margin-left: -4px; }
.mini-card:nth-child(1) { transform: rotate(-22deg) translateY(3px); }
.mini-card:nth-child(2) { transform: rotate(-7deg); }
.mini-card:nth-child(3) { transform: rotate(8deg); }
.mini-card:nth-child(4) { transform: rotate(23deg) translateY(3px); }
.red { background-color: var(--red) !important; }
.yellow { background-color: var(--yellow) !important; }
.green { background-color: var(--green) !important; }
.blue { background-color: var(--blue) !important; }

.entry-card { position: relative; border-radius: 22px; padding: 29px; transform: rotate(-.4deg); }
.entry-card::after { content: ""; position: absolute; left: 13px; right: 13px; bottom: -7px; height: 14px; background: var(--paper); clip-path: polygon(0 0, 4% 50%, 9% 0, 14% 54%, 20% 0, 25% 50%, 31% 0, 38% 52%, 44% 0, 50% 55%, 57% 0, 63% 53%, 70% 0, 77% 50%, 83% 0, 90% 51%, 96% 0, 100% 50%, 100% 100%, 0 100%); }
.entry-card-header { display: flex; align-items: center; justify-content: space-between; margin: -7px 0 20px; color: var(--muted); font-size: 13px; font-weight: 700; }
.entry-card-header p { margin: 0; }
.pin { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 -2px 2px rgba(0,0,0,.2), 0 2px 4px rgba(0,0,0,.2); }
.pin-red { background: var(--red); }
.pin-blue { background: var(--blue); }
.or-divider { display: flex; align-items: center; gap: 12px; color: #9a9e96; font-size: 12px; margin: 24px 0 18px; }
.or-divider::before, .or-divider::after { content: ""; height: 1px; flex: 1; background: #e3decf; }
.join-form label, .profile-form label { display: block; font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.join-row, .input-with-button { display: flex; gap: 9px; }
input, select { border: 1.5px solid #d8d7cd; background: white; border-radius: 12px; color: var(--ink); }
input { min-width: 0; padding: 13px 14px; }
.join-row input { flex: 1; text-transform: lowercase; font-size: 17px; letter-spacing: .12em; font-weight: 800; }
.join-form small, .profile-form small { color: #8a928c; font-size: 11px; display: block; margin-top: 8px; }

.recent-rooms { margin-top: 30px; }
.section-title-row { display: flex; align-items: baseline; justify-content: space-between; }
.section-title-row h2 { margin: 0 0 12px; font-family: var(--display); font-size: 19px; }
.section-title-row span { color: var(--muted); font-size: 11px; }
.recent-room-list { display: grid; gap: 8px; }
.recent-room { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; text-align: left; border: 1px solid rgba(23,37,31,.09); background: rgba(255,255,255,.5); border-radius: 13px; padding: 10px 13px; cursor: pointer; }
.recent-room:hover { background: rgba(255,255,255,.8); }
.recent-room .room-dot { width: 9px; height: 9px; background: var(--green); border-radius: 50%; }
.recent-room strong { letter-spacing: .1em; }
.recent-room span { font-size: 12px; color: var(--muted); }
.site-footer { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); color: rgba(23,37,31,.45); white-space: nowrap; font-size: 11px; }

/* Lobby */
.lobby-view { background: #e8eee1; padding: 27px clamp(18px, 5vw, 76px) 50px; }
.lobby-view::before { content: ""; position: fixed; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(23,37,31,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(23,37,31,.025) 1px, transparent 1px); background-size: 34px 34px; }
.room-header { min-height: 68px; }
.room-identity { text-align: center; }
.micro-logo { display: inline-block; font-family: Georgia, serif; font-style: italic; font-weight: 900; letter-spacing: -.07em; color: var(--red); font-size: 25px; transform: skew(-7deg); text-shadow: 2px 2px white; }
.room-identity p { margin: 0; font-size: 10px; color: var(--muted); letter-spacing: .12em; }
.room-code { border: 0; background: transparent; font-weight: 900; font-size: 19px; letter-spacing: .14em; cursor: pointer; }
.lobby-layout { position: relative; z-index: 2; width: min(1180px, 100%); margin: clamp(35px, 7vh, 80px) auto 0; display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 55px; align-items: center; }
.lobby-main { min-width: 0; }
.lobby-heading { text-align: center; }
.lobby-heading h2 { font-family: var(--display); font-size: clamp(30px, 4vw, 46px); margin: 0 0 8px; }
.lobby-heading > p:last-child { color: var(--muted); margin: 0; }
.seat-grid { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 24px 15px; margin-top: 45px; }
.seat { position: relative; text-align: center; min-height: 138px; }
.seat-chair { width: 86px; height: 86px; margin: 0 auto 10px; border: 2px dashed rgba(23,37,31,.22); border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.24); transition: .2s ease; }
.seat.empty .seat-chair::before { content: "+"; color: rgba(23,37,31,.26); font-size: 30px; }
.seat.occupied .seat-chair { border-style: solid; border-color: rgba(23,37,31,.42); background: var(--paper); box-shadow: 0 9px 18px rgba(23,37,31,.14); }
.seat .avatar { width: 68px; height: 68px; }
.seat-name { display: block; font-weight: 850; font-size: 14px; max-width: 120px; margin: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-status { font-size: 10px; color: var(--muted); }
.host-ribbon { position: absolute; top: -8px; left: 50%; transform: translateX(-50%) rotate(-3deg); background: var(--yellow); border: 1px solid #b1870b; padding: 3px 8px; border-radius: 4px; font-size: 9px; font-weight: 900; z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,.12); }
.offline-dot { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #9aa49e; border: 3px solid var(--paper); right: calc(50% - 36px); bottom: 50px; }
.lobby-panel { border-radius: 19px; padding: 25px; transform: rotate(.5deg); }
.profile-preview { display: flex; align-items: center; gap: 15px; margin-bottom: 22px; }
.profile-preview h3 { margin: 0; font-family: var(--display); font-size: 22px; }
.avatar { display: grid; place-items: center; flex: none; border-radius: 50%; background: #fff8de; border: 2px solid var(--ink); font-family: var(--display); font-weight: 900; overflow: hidden; }
.avatar-large { width: 66px; height: 66px; font-size: 27px; box-shadow: 5px 5px 0 rgba(23,37,31,.12); }
.avatar-small { width: 41px; height: 41px; font-size: 18px; border-color: rgba(255,255,255,.8); }
.profile-form { margin-bottom: 18px; }
.input-with-button input { flex: 1; }
.input-with-button .button { padding-inline: 13px; }
.torn-divider { height: 1px; border-top: 2px dashed #ded9c9; margin: 25px 0 20px; }
.control-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.control-row label { display: block; font-weight: 800; }
.control-row small { color: var(--muted); }
.control-row select { padding: 9px 30px 9px 12px; font-weight: 800; }
.lobby-notice { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0 0; }

/* Game table */
.game-view { min-height: 100dvh; color: white; overflow: hidden; background: radial-gradient(circle at 50% 42%, #16885e 0, #0a6948 52%, #064933 100%); }
.game-view::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .17; background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 40h80M40 0v80' stroke='%23ffffff' stroke-opacity='.07'/%3E%3Ccircle cx='40' cy='40' r='28' fill='none' stroke='%23ffffff' stroke-opacity='.08'/%3E%3C/svg%3E"); }
.game-header { position: absolute; left: 25px; right: 25px; top: 19px; }
.game-room-code { border: 0; color: white; background: transparent; font-family: Georgia, serif; font-style: italic; font-weight: 900; font-size: 20px; cursor: pointer; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.round-label { font-size: 12px; background: rgba(4,55,37,.38); border: 1px solid rgba(255,255,255,.15); padding: 8px 12px; border-radius: 99px; }
.game-hud { position: absolute; z-index: 5; top: 71px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; }
.hud-chip { display: flex; align-items: center; gap: 6px; padding: 7px 11px; border: 1px solid rgba(255,255,255,.16); border-radius: 99px; background: rgba(3,56,37,.4); backdrop-filter: blur(8px); font-size: 11px; white-space: nowrap; }
.hud-chip b { font-size: 11px; }
.hud-button { color: white; cursor: pointer; }
.deck-icon { width: 13px; height: 17px; background: #183127; border: 1px solid white; border-radius: 2px; transform: rotate(-5deg); }
#currentColorDot { width: 10px; height: 10px; border-radius: 50%; background: white; box-shadow: 0 0 0 2px rgba(255,255,255,.23); }
#directionIcon { font-size: 17px; }
.table-wrap { position: absolute; inset: 112px 0 168px; }
.table-rail { position: absolute; left: 7%; right: 7%; top: 4%; bottom: 3%; border: 2px solid rgba(255,255,255,.07); border-radius: 50%; box-shadow: inset 0 0 70px rgba(0,0,0,.08), 0 0 0 14px rgba(4,67,45,.14); }
.table-center { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: clamp(20px, 4vw, 55px); }
.pile { position: relative; width: 86px; height: 124px; border: 0; background: transparent; padding: 0; }
.draw-pile { cursor: pointer; }
.pile::before, .pile::after { content: ""; position: absolute; inset: 0; border-radius: 10px; border: 3px solid rgba(255,255,255,.72); background: #173529; }
.pile::before { transform: translate(-7px, 5px) rotate(-4deg); opacity: .65; }
.pile::after { transform: translate(5px, 2px) rotate(3deg); opacity: .8; }
.card-back { position: relative; z-index: 2; width: 100%; height: 100%; display: grid; place-items: center; border-radius: 10px; border: 4px solid #fff; background: repeating-linear-gradient(135deg, #1a2722 0 7px, #233e33 7px 14px); box-shadow: 0 13px 23px rgba(0,0,0,.28); }
.card-back i { display: grid; place-items: center; width: 67px; height: 38px; border-radius: 50%; transform: rotate(-28deg); background: var(--red); color: var(--yellow); font-family: Georgia, serif; font-weight: 900; font-size: 21px; text-shadow: 1px 2px #7c1720; }
.draw-pile small, .discard-pile small { position: absolute; z-index: 3; top: calc(100% + 9px); left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.75); white-space: nowrap; font-size: 11px; font-weight: 800; }
.draw-pile:disabled { cursor: not-allowed; filter: saturate(.6); }
.discard-pile::before, .discard-pile::after { background: rgba(3,50,33,.24); border-color: rgba(255,255,255,.12); }

.uno-card {
  --card-color: #555;
  position: relative;
  flex: 0 0 auto;
  width: 78px;
  height: 112px;
  border: 4px solid #fff;
  border-radius: 10px;
  background: var(--card-color);
  color: white;
  box-shadow: 0 8px 16px rgba(0,0,0,.23);
  overflow: hidden;
  user-select: none;
}
.uno-card::before { content: ""; position: absolute; width: 95px; height: 58px; left: -12px; top: 23px; background: rgba(255,255,255,.92); border-radius: 50%; transform: rotate(-31deg); }
.uno-card::after { content: attr(data-symbol); position: absolute; inset: 0; display: grid; place-items: center; font-family: Georgia, var(--body); font-size: 42px; font-weight: 900; font-style: italic; color: var(--card-color); text-shadow: 0 2px 0 rgba(0,0,0,.08); }
.uno-card .corner { position: absolute; z-index: 2; top: 3px; left: 5px; font-family: Georgia, var(--body); font-weight: 900; font-size: 15px; line-height: 1; }
.uno-card .corner.bottom { top: auto; left: auto; right: 5px; bottom: 3px; transform: rotate(180deg); }
.uno-card.color-red { --card-color: var(--red); }
.uno-card.color-yellow { --card-color: var(--yellow); color: #322c14; }
.uno-card.color-green { --card-color: var(--green); }
.uno-card.color-blue { --card-color: var(--blue); }
.uno-card.color-wild { --card-color: #252a28; }
.uno-card.color-wild::before { background: conic-gradient(var(--red) 0 25%, var(--yellow) 0 50%, var(--green) 0 75%, var(--blue) 0); }
.uno-card.color-wild::after { color: white; text-shadow: 0 2px 3px rgba(0,0,0,.5); }
.discard-pile .uno-card { position: relative; z-index: 3; transform: rotate(4deg); }

.opponents { position: absolute; inset: 0; pointer-events: none; }
.opponent { position: absolute; width: 150px; transform: translate(-50%, -50%); text-align: center; transition: left .35s ease, top .35s ease; }
.opponent-avatar { position: relative; display: inline-grid; place-items: center; width: 55px; height: 55px; border-radius: 50%; color: var(--ink); background: #fff7d8; border: 3px solid white; font-family: var(--display); font-size: 21px; font-weight: 900; box-shadow: 0 8px 14px rgba(0,0,0,.22); }
.opponent.active .opponent-avatar { box-shadow: 0 0 0 5px var(--yellow), 0 8px 14px rgba(0,0,0,.25); animation: active-pulse 1.8s ease-in-out infinite; }
@keyframes active-pulse { 50% { box-shadow: 0 0 0 9px rgba(245,198,40,.24), 0 8px 14px rgba(0,0,0,.25); } }
.opponent.offline { opacity: .56; filter: grayscale(.5); }
.opponent .host-mark { position: absolute; top: -8px; right: -17px; background: var(--yellow); color: var(--ink); padding: 2px 5px; border-radius: 4px; font-size: 8px; font-family: var(--body); }
.opponent-name { display: block; margin-top: 7px; font-size: 12px; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opponent-cards { display: inline-flex; align-items: center; gap: 3px; margin-top: 4px; color: rgba(255,255,255,.75); font-size: 10px; }
.opponent-cards i { width: 12px; height: 17px; background: #152c23; border: 1px solid rgba(255,255,255,.7); border-radius: 2px; }
.opponent.pending-uno::after { content: "漏喊 UNO!"; position: absolute; top: -4px; left: calc(50% + 36px); color: #3b2600; background: var(--yellow); padding: 5px 7px; border-radius: 8px 8px 8px 0; font-size: 9px; font-weight: 900; animation: bob .7s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-4px) rotate(2deg); } }
.turn-callout { position: absolute; left: 50%; top: calc(52% + 91px); transform: translateX(-50%); background: rgba(4,56,38,.7); border: 1px solid rgba(255,255,255,.16); border-radius: 99px; padding: 7px 13px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.turn-callout.your-turn { background: var(--yellow); color: var(--ink); box-shadow: 0 5px 0 #a87e04; }
.turn-timer { position: absolute; left: 50%; top: calc(52% + 132px); transform: translateX(-50%); width: 170px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.17); overflow: hidden; }
.turn-timer span { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--yellow); transform-origin: left; }

.hand-dock { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; height: 183px; background: linear-gradient(180deg, rgba(5,70,47,0), rgba(4,50,35,.78) 28%, rgba(3,42,29,.96)); }
.self-strip { position: absolute; left: 24px; bottom: 25px; display: flex; align-items: center; gap: 9px; }
.self-strip strong, .self-strip span { display: block; }
.self-strip strong { font-size: 13px; }
.self-strip span { color: rgba(255,255,255,.64); font-size: 10px; margin-top: 2px; }
.self-strip .spectator-badge { color: var(--yellow); margin-left: 7px; }
.hand { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); height: 154px; width: min(65vw, 850px); display: flex; align-items: flex-end; justify-content: center; padding: 0 40px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.hand::-webkit-scrollbar { display: none; }
.hand .uno-card { width: clamp(58px, 6vw, 78px); height: clamp(84px, 8.6vw, 112px); margin-left: clamp(-26px, -1.8vw, -10px); cursor: pointer; transition: transform .18s cubic-bezier(.2,.8,.2,1), margin .18s ease, filter .18s ease; transform-origin: center bottom; }
.hand .uno-card:first-child { margin-left: 0; }
.hand .uno-card:hover { transform: translateY(-14px) rotate(-1deg); z-index: 5; }
.hand .uno-card.selected { transform: translateY(-30px) scale(1.05); margin-left: 2px; margin-right: 12px; z-index: 6; box-shadow: 0 0 0 4px var(--yellow), 0 15px 25px rgba(0,0,0,.3); }
.hand .uno-card.unplayable { filter: saturate(.5) brightness(.78); }
.hand-empty { align-self: center; color: rgba(255,255,255,.6); font-size: 12px; }
.game-actions { position: absolute; right: 25px; bottom: 25px; display: flex; align-items: center; gap: 8px; }
.uno-button { position: relative; width: 72px; height: 50px; border-radius: 50%; color: var(--yellow); background: var(--red); font-family: Georgia, serif; font-style: italic; font-size: 17px; text-shadow: 1px 1px #921923; box-shadow: 0 5px 0 #8c1920; transform: rotate(-5deg); }
.uno-button.ready { animation: uno-ready .7s ease-in-out infinite alternate; }
@keyframes uno-ready { to { transform: rotate(3deg) scale(1.1); box-shadow: 0 5px 0 #8c1920, 0 0 22px rgba(245,198,40,.8); } }

.game-log { position: absolute; z-index: 11; top: 111px; right: 20px; width: min(330px, calc(100vw - 40px)); max-height: 370px; overflow: auto; padding: 16px; border: 1px solid rgba(255,255,255,.16); border-radius: 15px; background: rgba(3,44,30,.88); backdrop-filter: blur(15px); box-shadow: 0 18px 40px rgba(0,0,0,.28); }
.log-heading { display: flex; justify-content: space-between; margin-bottom: 11px; }
.log-heading button { border: 0; background: transparent; color: white; font-size: 21px; cursor: pointer; }
.log-entry { display: flex; gap: 8px; font-size: 11px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.08); color: rgba(255,255,255,.75); }
.log-entry:first-child { color: white; }
.log-entry::before { content: "•"; color: var(--yellow); }
.action-prompt { position: absolute; z-index: 8; left: 50%; bottom: 184px; transform: translateX(-50%); width: min(480px, calc(100vw - 30px)); padding: 14px 16px; text-align: center; color: var(--ink); background: var(--paper); border: 1px solid rgba(0,0,0,.12); border-radius: 14px; box-shadow: var(--shadow); }
.action-prompt p { margin: 0 0 10px; font-size: 13px; }
.action-prompt-buttons { display: flex; justify-content: center; gap: 8px; }
.action-prompt-buttons.opening-colors .button { min-width: 44px; color: white; padding: 10px 12px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.action-prompt-buttons.opening-colors .button.yellow { color: var(--ink); }

/* Modal and feedback */
.modal-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(7, 18, 13, .64); backdrop-filter: blur(6px); }
.modal { position: relative; width: min(560px, 100%); max-height: calc(100dvh - 36px); overflow: auto; background: var(--paper); color: var(--ink); border-radius: 21px; padding: clamp(24px, 4vw, 40px); box-shadow: 0 28px 75px rgba(0,0,0,.4); animation: modal-in .22s cubic-bezier(.2,.8,.2,1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.modal h2 { font-family: var(--display); font-size: clamp(29px, 5vw, 42px); margin: 0 0 20px; }
.modal-close { position: absolute; top: 14px; right: 15px; width: 34px; height: 34px; border: 0; border-radius: 50%; font-size: 25px; line-height: 1; cursor: pointer; background: #eee9db; }
.rules-intro { display: flex; align-items: center; gap: 16px; background: #f0ecdf; padding: 14px; border-radius: 13px; margin-bottom: 18px; }
.rules-intro p { margin: 0; font-size: 13px; line-height: 1.7; }
.rule-number { flex: none; display: grid; place-items: center; width: 48px; height: 66px; border-radius: 6px; color: white; background: var(--red); border: 3px solid white; box-shadow: 0 3px 8px rgba(0,0,0,.2); font: italic 900 30px Georgia, serif; }
.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.rule-grid > div { border: 1px solid #e5dfcf; border-radius: 12px; padding: 12px; }
.rule-grid h3 { margin: 8px 0 4px; font-size: 13px; }
.rule-grid p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.rule-card { display: grid; place-items: center; width: 33px; height: 46px; border: 2px solid white; border-radius: 5px; color: white; font: 900 14px Georgia, serif; box-shadow: 0 2px 5px rgba(0,0,0,.19); }
.rule-card.yellow { color: var(--ink); }
.rule-card.wild { background: conic-gradient(var(--red) 0 25%, var(--yellow) 0 50%, var(--green) 0 75%, var(--blue) 0); text-shadow: 1px 1px 2px #000; }
.rules-note { margin: 18px 0; padding: 12px; border-left: 4px solid var(--yellow); background: #fffae9; font-size: 11px; line-height: 1.6; }
.color-modal { width: min(440px, 100%); text-align: center; }
.color-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.color-choice { aspect-ratio: 1; border-radius: 50%; border: 5px solid white; color: white; font-size: 20px; font-weight: 900; cursor: pointer; box-shadow: 0 5px 12px rgba(0,0,0,.22); transition: transform .15s ease; }
.color-choice.yellow { color: var(--ink); }
.color-choice:hover { transform: scale(1.1) rotate(4deg); }
.text-button { border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); margin-top: 18px; cursor: pointer; }
.round-modal { width: min(470px, 100%); text-align: center; }
.round-modal h2 { margin-bottom: 12px; }
.confetti { color: var(--red); letter-spacing: 14px; margin-bottom: 12px; overflow: hidden; white-space: nowrap; }
.avatar-winner { width: 82px; height: 82px; margin: 8px auto 12px; font-size: 35px; border-width: 3px; box-shadow: 7px 7px 0 var(--yellow); }
.round-modal h3 { margin: 0; font-family: var(--display); font-size: 24px; }
.round-modal > p { color: var(--muted); }
.scoreboard { margin: 18px 0; border: 1px solid #e3dece; border-radius: 12px; overflow: hidden; }
.score-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 10px 12px; text-align: left; border-top: 1px solid #ece7d8; font-size: 12px; }
.score-row:first-child { border-top: 0; }
.score-row span { color: var(--muted); }
.score-row b:last-child { min-width: 42px; text-align: right; }
.confirm-modal { width: min(430px, 100%); text-align: center; }
.confirm-modal h2 { margin-bottom: 9px; }
.confirm-modal p { color: var(--muted); line-height: 1.7; font-size: 13px; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.toast-stack { position: fixed; z-index: 50; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 28px)); pointer-events: none; }
.toast { padding: 12px 15px; border-radius: 11px; color: white; background: #17251f; box-shadow: 0 10px 25px rgba(0,0,0,.25); text-align: center; font-size: 12px; font-weight: 750; animation: toast-in .22s ease, toast-out .25s ease 2.75s forwards; }
.toast.error { background: #a82229; }
.toast.success { background: #0c754d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
.connection-banner { position: fixed; z-index: 60; top: 0; left: 50%; transform: translateX(-50%); background: var(--yellow); color: var(--ink); padding: 8px 17px; border-radius: 0 0 10px 10px; font-size: 11px; font-weight: 800; box-shadow: var(--soft-shadow); }

@media (max-width: 900px) {
  .lobby-layout { grid-template-columns: 1fr; margin-top: 28px; gap: 28px; }
  .lobby-panel { width: min(520px, 100%); margin: auto; }
  .seat-grid { grid-template-columns: repeat(4, 1fr); margin-top: 28px; }
  .table-rail { left: 3%; right: 3%; }
  .game-actions { right: 12px; bottom: 15px; }
  .self-strip { left: 12px; bottom: 15px; }
  .hand { width: 70vw; }
}

@media (max-width: 650px) {
  .home-view { padding: 18px 15px 32px; }
  .home-topbar .online-pill { font-size: 0; padding: 10px; }
  .home-topbar .online-pill i { margin: 0; }
  .home-stage { margin-top: 35px; }
  .entry-card { padding: 23px 18px; }
  .join-row { flex-direction: column; }
  .room-header { align-items: flex-start; }
  .room-header > .button { padding-inline: 10px; font-size: 11px; }
  .lobby-view { padding: 15px 12px 38px; }
  .seat-grid { grid-template-columns: repeat(2, 1fr); gap: 18px 8px; }
  .seat { min-height: 125px; }
  .seat-chair { width: 76px; height: 76px; }
  .seat .avatar { width: 60px; height: 60px; }
  .game-header { left: 10px; right: 10px; top: 9px; }
  .game-header .button { font-size: 0; width: 40px; height: 36px; padding: 0; }
  .game-header .button::before { content: "←"; font-size: 18px; }
  .game-hud { top: 55px; width: calc(100vw - 16px); justify-content: center; gap: 4px; }
  .hud-chip { padding: 6px 8px; font-size: 9px; }
  .hud-chip b { font-size: 9px; }
  .hud-button { display: none; }
  .table-wrap { inset: 93px 0 157px; }
  .table-rail { left: -35%; right: -35%; top: 3%; bottom: 0; }
  .table-center { top: 54%; gap: 30px; }
  .pile { width: 67px; height: 97px; }
  .card-back i { width: 52px; font-size: 15px; }
  .discard-pile .uno-card { width: 67px; height: 97px; }
  .opponent { width: 108px; }
  .opponent-avatar { width: 46px; height: 46px; font-size: 17px; }
  .opponent-name { font-size: 10px; }
  .turn-callout { top: calc(54% + 76px); }
  .turn-timer { top: calc(54% + 112px); width: 130px; }
  .hand-dock { height: 163px; }
  .hand { left: 0; bottom: -6px; transform: none; justify-content: flex-start; width: calc(100vw - 110px); height: 133px; padding: 0 12px 0 17px; }
  .hand .uno-card { width: 62px; height: 90px; margin-left: -17px; }
  .uno-card::before { width: 77px; height: 46px; top: 18px; }
  .uno-card::after { font-size: 31px; }
  .uno-card .corner { font-size: 12px; }
  .self-strip { display: none; }
  .game-actions { flex-direction: column-reverse; align-items: stretch; bottom: 12px; }
  .game-actions .button:not(.uno-button) { width: 92px; padding: 10px 8px; font-size: 11px; }
  .uno-button { align-self: center; width: 62px; height: 43px; }
  .action-prompt { bottom: 162px; }
  .rule-grid { grid-template-columns: repeat(2, 1fr); }
  .rules-modal { padding: 27px 20px; }
}

@media (max-height: 680px) and (min-width: 651px) {
  .table-wrap { inset: 85px 0 142px; }
  .game-hud { top: 55px; }
  .hand-dock { height: 155px; }
  .hand { height: 137px; }
  .hand .uno-card { width: 64px; height: 93px; }
  .game-actions, .self-strip { bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
