* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans";
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(137,180,250,0.12), transparent 60%),
    radial-gradient(1000px 600px at 80% 10%, rgba(116,199,236,0.12), transparent 60%),
    var(--ctp-base);
  color: var(--ctp-text);
}

a { color: var(--ctp-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(24, 24, 37, 0.75);
  border-bottom: 1px solid rgba(137,180,250,0.18);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; flex-direction: column; gap: 4px; }
.logo { font-weight: 900; letter-spacing: 1px; color: var(--ctp-blue); }
.subtitle { color: var(--ctp-subtext0); font-size: 12px; }

.layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-auto-rows: min-content;
  gap: 14px;
  padding: 14px;
}

.panel {
  background: rgba(17, 17, 27, 0.55);
  border: 1px solid rgba(137,180,250,0.16);
  border-radius: 14px;
  padding: 14px;
}

.panel.wide { grid-column: 1 / span 2; }

h2, h3 { margin: 0 0 10px 0; }
.muted { color: var(--ctp-subtext0); font-size: 13px; }
.divider { height: 1px; background: rgba(137,180,250,0.16); margin: 12px 0; }

.btn {
  border: 1px solid rgba(137,180,250,0.25);
  background: rgba(49, 50, 68, 0.5);
  color: var(--ctp-text);
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.btn:hover { border-color: rgba(137,180,250,0.5); }
.btn.primary {
  background: rgba(137,180,250,0.18);
  border-color: rgba(137,180,250,0.55);
}
.btn.danger {
  border-color: rgba(243,139,168,0.5);
  background: rgba(243,139,168,0.12);
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.rooms { display: grid; gap: 10px; }
.roomCard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(137,180,250,0.16);
  background: rgba(49, 50, 68, 0.35);
}
.roomCard .name { font-weight: 800; }

.form { display: grid; gap: 10px; }
input {
  width: 100%;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid rgba(137,180,250,0.2);
  background: rgba(17,17,27,0.35);
  color: var(--ctp-text);
  outline: none;
}
input:focus { border-color: rgba(137,180,250,0.55); }
.row { display: flex; align-items: center; gap: 10px; }

.gameHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.messages { min-height: 18px; margin-bottom: 10px; }
.msg {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(49, 50, 68, 0.35);
  border: 1px solid rgba(137,180,250,0.14);
}

/* --- Bigger UNO table --- */
.unoTable {
  position: relative;
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(137,180,250,0.16);
  background:
    radial-gradient(1100px 650px at 50% 45%, rgba(137,180,250,0.08), transparent 60%),
    radial-gradient(900px 520px at 50% 45%, rgba(116,199,236,0.06), transparent 60%),
    linear-gradient(180deg, rgba(24,24,37,0.35), rgba(17,17,27,0.25));
  overflow: hidden;
  min-height: 720px;
}

/* --- Seats (readable, turn outline) --- */
.seat {
  position: absolute;
  width: 260px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(137,180,250,0.18);
  background: rgba(49,50,68,0.25);
  backdrop-filter: blur(6px);
}

.seat .name {
  font-weight: 950;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.seat .meta {
  font-size: 13px;
  color: var(--ctp-subtext0);
  margin-top: 4px;
}

/* nice turn outline for everyone */
.seat.turn {
  border-color: rgba(137,180,250,0.85);
  box-shadow:
    0 0 0 2px rgba(137,180,250,0.18),
    0 0 26px rgba(137,180,250,0.18);
}

/* 8-seat layout: top row 3, bottom row 3, left mid, right mid */
.seatN0 { top: 14px; left: 50%; transform: translateX(-50%); text-align: center; }
.seatN1 { top: 14px; left: 18%; transform: translateX(-50%); text-align: center; }
.seatN2 { top: 14px; left: 82%; transform: translateX(-50%); text-align: center; }

.seatN3 { left: 14px; top: 50%; transform: translateY(-50%); }
.seatN4 { right: 14px; top: 50%; transform: translateY(-50%); text-align: right; }

.seatN5 { bottom: 220px; left: 50%; transform: translateX(-50%); text-align: center; }
.seatN6 { bottom: 220px; left: 18%; transform: translateX(-50%); text-align: center; }
.seatN7 { bottom: 220px; left: 82%; transform: translateX(-50%); text-align: center; }

/* Center piles (discard only) */
.piles {
  position: absolute;
  top: 210px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.pileBox {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(137,180,250,0.14);
  background: rgba(17,17,27,0.18);
}

.pileTitle { font-size: 12px; color: var(--ctp-subtext0); }

/* Action strip */
.actionStrip {
  position: absolute;
  top: 180px;
  right: 14px;
  width: 300px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(137,180,250,0.14);
  background: rgba(17,17,27,0.18);
}

/* --- Cards: opaque, no inner overlay --- */
.card {
  width: 190px;
  height: 250px;
  border-radius: 18px;
  border: 2px solid rgba(137,180,250,0.25);
  background: linear-gradient(180deg, rgba(69,71,90,1), rgba(24,24,37,1));
  display: grid;
  place-items: center;
  font-weight: 950;
  font-size: 30px;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0,0,0,0.35);
  user-select: none;
}

/* Catppuccin mapping for in-game colors */
:root {
  --uno-red: var(--ctp-mauve);
  --uno-green: var(--ctp-green);
  --uno-blue: var(--ctp-blue);
  --uno-yellow: var(--ctp-peach);
}

.card.red { border-color: color-mix(in oklab, var(--uno-red) 85%, white 0%); }
.card.green { border-color: color-mix(in oklab, var(--uno-green) 85%, white 0%); }
.card.blue { border-color: color-mix(in oklab, var(--uno-blue) 85%, white 0%); }
.card.yellow { border-color: color-mix(in oklab, var(--uno-yellow) 85%, white 0%); }

.card.wild, .card.wild_draw4 {
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(69,71,90,1), rgba(24,24,37,1)) padding-box,
    conic-gradient(from 90deg,
      var(--ctp-mauve), var(--ctp-peach), var(--ctp-green), var(--ctp-blue), var(--ctp-lavender), var(--ctp-mauve)
    ) border-box;
}

/* --- Hand dock: show only top half of cards (peek) --- */
.handDock {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  height: 190px;
  border-radius: 16px;
  border: 1px solid rgba(137,180,250,0.14);
  background: rgba(17,17,27,0.18);
  padding: 12px 14px;
  overflow: hidden; /* important for peek effect */
}

.handDock.turn {
  border-color: rgba(137,180,250,0.85);
  box-shadow:
    0 0 0 2px rgba(137,180,250,0.18),
    0 0 28px rgba(137,180,250,0.18);
}

.handTitle { font-size: 12px; color: var(--ctp-subtext0); margin-bottom: 10px; }

.handRowPeek {
  position: relative;
  height: 150px;
  overflow: hidden; /* cards extend below; we only show top half */
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 60px; /* creates "cut" so you only see top part */
}

/* Hand cards: opaque, no tilt, look like real cards */
.handCard {
  width: 120px;
  height: 190px;
  border-radius: 16px;
  border: 2px solid rgba(137,180,250,0.2);
  background: linear-gradient(180deg, rgba(69,71,90,1), rgba(24,24,37,1));
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  padding: 10px;
  display: grid;
  align-content: space-between;

  /* Peek effect: push card down so only top half is visible */
  transform: translateY(70px);
  transition: transform 120ms ease, border-color 120ms ease;
}

.handCard:hover {
  transform: translateY(40px);
  border-color: rgba(137,180,250,0.75);
}

.handCard.red { border-color: color-mix(in oklab, var(--uno-red) 85%, white 0%); }
.handCard.green { border-color: color-mix(in oklab, var(--uno-green) 85%, white 0%); }
.handCard.blue { border-color: color-mix(in oklab, var(--uno-blue) 85%, white 0%); }
.handCard.yellow { border-color: color-mix(in oklab, var(--uno-yellow) 85%, white 0%); }

.handCard.wild, .handCard.wild_draw4 {
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(69,71,90,1), rgba(24,24,37,1)) padding-box,
    conic-gradient(from 90deg,
      var(--ctp-mauve), var(--ctp-peach), var(--ctp-green), var(--ctp-blue), var(--ctp-lavender), var(--ctp-mauve)
    ) border-box;
}

.handCard .v { font-weight: 950; font-size: 22px; }
.handCard .c { font-size: 12px; color: var(--ctp-subtext0); }

.wildColors .colorBtn {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(137,180,250,0.25);
  background: rgba(49, 50, 68, 0.35);
  color: var(--ctp-text);
  cursor: pointer;
}
.colorRow { display: flex; gap: 8px; flex-wrap: wrap; }

.resultsBox {
  padding: 10px 12px;
  border: 1px solid rgba(137,180,250,0.14);
  border-radius: 14px;
  background: rgba(49,50,68,0.25);
}