:root{
  --tet-red:#b10000;
  --tet-red2:#ff3030;
  --gold:#ffd782;
  --gold2:#ffefb7;
  --panel: rgba(255,255,255,.88);
  --panel2: rgba(255,255,255,.78);
  --shadow: 0 14px 35px rgba(0,0,0,.28);
}

*{ box-sizing:border-box; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial; }
body{ margin:0; min-height:100vh; color:#1e1e1e; }

body.home{ background: url("../imgs/bg.png") center/cover no-repeat fixed; }
body.room{ background: url("../imgs/bgroom.png") center/cover no-repeat fixed; }

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px;
  background: linear-gradient(135deg, rgba(177,0,0,.92), rgba(255,48,48,.72));
  border-bottom: 1px solid rgba(255,215,130,.55);
  box-shadow: 0 10px 24px rgba(0,0,0,.20);
}

.brand__title{
  font-weight:900; letter-spacing:.8px; color:#fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.brand__sub{ color: rgba(255,255,255,.92); font-size:12px; }

.me{ display:flex; gap:10px; align-items:center; }

.wrap{ max-width: 1120px; margin: 0 auto; padding: 18px; }

.grid2{ display:grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 980px){ .grid2{ grid-template-columns: 1fr; } }

.roomGrid{ display:grid; grid-template-columns: 380px 1fr; gap:16px; }
@media (max-width: 980px){ .roomGrid{ grid-template-columns: 1fr; } }

.card{
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,215,130,.45);
  overflow:hidden;
  position:relative;
}

.card::before{
  content:"";
  position:absolute; inset:0;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,215,130,.55), transparent 38%),
    radial-gradient(circle at 92% 12%, rgba(255,215,130,.40), transparent 42%),
    radial-gradient(circle at 88% 88%, rgba(255,215,130,.35), transparent 42%);
  pointer-events:none;
}

.card__head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  position:relative;
}
.card__head h2{ margin:0; font-size:18px; }
.card__body{ padding: 14px; position:relative; }

.small{ font-size:12px; color: rgba(0,0,0,.70); }
.hint{ font-size:12px; color: rgba(0,0,0,.65); margin-top:6px; }

.badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius: 999px;
  background: rgba(255,215,130,.28);
  border: 1px solid rgba(255,215,130,.65);
  font-weight:700;
}

.row{ display:flex; gap:10px; align-items:center; }
.row > *{ flex:1; }

.tabs{ display:flex; gap:8px; }
.tab{
  border: 1px solid rgba(255,215,130,.7);
  background: rgba(255,255,255,.45);
  padding: 8px 10px;
  border-radius: 999px;
  cursor:pointer;
  font-weight:800;
}
.tab.active{ background: rgba(177,0,0,.12); border-color: rgba(177,0,0,.25); }

.form{ display:flex; flex-direction:column; gap:8px; }
.label{ font-size:12px; font-weight:800; color: rgba(0,0,0,.70); }

input, select, button{
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.12);
  outline:none;
  background: rgba(255,255,255,.7);
}
select{ cursor:pointer; }

.btn{
  cursor:pointer;
  border: 1px solid rgba(177,0,0,.35);
  background: linear-gradient(135deg, var(--tet-red), var(--tet-red2));
  color:#fff;
  font-weight:900;
  letter-spacing:.3px;
}
.btn:hover{ filter: brightness(1.03); }
.btn--ghost{
  background: rgba(255,255,255,.55);
  color: #7a0000;
  border: 1px solid rgba(255,215,130,.8);
}

.list{ display:flex; flex-direction:column; gap:8px; }
.item{
  display:flex; justify-content:space-between; align-items:center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(0,0,0,.08);
}

.table{ width:100%; border-collapse: collapse; overflow:hidden; border-radius: 14px; }
.table th, .table td{ padding: 8px; border-bottom: 1px solid rgba(0,0,0,.08); text-align:left; }
.table th{ background: rgba(177,0,0,.08); }

.sectionTitle{ font-weight:900; color:#7a0000; margin-bottom:6px; }

.steps{ margin-top:12px; padding:12px; border-radius: 16px; background: rgba(255,255,255,.55); border:1px dashed rgba(177,0,0,.22); }
.steps__title{ font-weight:900; margin-bottom:6px; color:#7a0000; }
.steps__list{ margin:0; padding-left:18px; }

.panel{ padding: 12px; border-radius: 16px; background: rgba(255,255,255,.55); border: 1px solid rgba(255,215,130,.7); }
.panel__title{ font-weight:900; color:#7a0000; }
.panel__row{ display:flex; justify-content:space-between; align-items:center; margin-top:8px; }

.create{ padding: 12px; border-radius: 16px; background: rgba(255,255,255,.55); border: 1px solid rgba(255,215,130,.7); }
.create__title{ font-weight:900; color:#7a0000; margin-bottom:8px; }

.hostBox{ padding: 12px; border-radius: 16px; background: rgba(255,255,255,.55); border: 1px solid rgba(255,215,130,.7); }
.hostBox__title{ font-weight:900; color:#7a0000; margin-bottom:6px; }

.turn{ font-weight:900; color:#7a0000; }

.board-shell{ display:flex; justify-content:center; align-items:flex-start; padding: 10px; }
#boardCanvas{
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(255,215,130,.55);
  background: transparent;
  max-width: 100%;
  height: auto;
}

.toast{
  position: fixed;
  right: 14px;
  bottom: 14px;
  background: rgba(0,0,0,.85);
  color:#fff;
  padding:10px 12px;
  border-radius: 12px;
  display:none;
  max-width: 360px;
}



/* v1.05 Sound switch */
.switch{position:relative;display:inline-block;width:48px;height:28px}
.switch input{opacity:0;width:0;height:0}
.switch .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#bbb;transition:.2s;border-radius:999px}
.switch .slider:before{position:absolute;content:"";height:22px;width:22px;left:3px;bottom:3px;background:white;transition:.2s;border-radius:999px}
.switch input:checked + .slider{background:#d20000}
.switch input:checked + .slider:before{transform:translateX(20px)}
#soundVolume{accent-color:#d20000}

/* v1.08 additions */
.board-shell{ position: relative; }

.winOverlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
  z-index: 10;
}

.winCard{
  width: min(520px, 92%);
  padding: 18px 18px 14px;
  border-radius: 18px;
  border: 2px solid rgba(255,215,130,.75);
  background: linear-gradient(180deg, rgba(177,0,0,.95), rgba(255,48,48,.75));
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  text-align:center;
}

.winTitle{
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
  font-size: 18px;
  margin-bottom: 10px;
}

.winName{
  font-weight: 900;
  color: #fff;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  margin: 6px 0 8px;
  text-shadow: 0 3px 0 rgba(0,0,0,.25);
}

.winPoints{
  font-weight: 800;
  color: rgba(255,239,183,.98);
  font-size: 20px;
  margin-bottom: 12px;
}

.winBtns{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
}

/* v1.16 Mobile update */

#boardCanvas{ touch-action: none; }

.mobileTabs{ display:none; gap:8px; align-items:center; }
.mobileTabs .mTab{
  flex:1;
  border-radius:999px;
  padding:8px 10px;
  border:1px solid rgba(255,215,130,.75);
  background: rgba(255,255,255,.35);
  font-weight:900;
  color:#7a0000;
  cursor:pointer;
}
.mobileTabs .mTab.active{
  background: rgba(255,215,130,.35);
  border-color: rgba(255,215,130,.95);
}

@media (max-width: 640px){
  .wrap{ padding: 12px; }
  .topbar{ position: sticky; top: 0; z-index: 50; padding: 10px 12px; }
  .brand__title{ font-size: 14px; }
  .brand__sub{ font-size: 11px; }
  .me .btn{ padding: 8px 10px; }

  /* Make rows stack nicely */
  .row{ flex-wrap: wrap; }
  .row > *{ flex: 1 1 100%; }

  /* Room: show mobile tabs and focus one card at a time */
  .mobileTabs{ display:flex; min-width: 170px; }
  .roomGrid{ gap: 12px; }

  .card__head h2{ font-size: 16px; }
  .btn{ padding: 12px 14px; }
  input, select, button{ padding: 12px 14px; }

  .board-shell{ padding: 8px; }
  /* Canvas will be resized by JS to fill the viewport; keep it fluid */
  #boardCanvas{ width: 100%; height: auto; max-width: none; }

  .winCard{ width: min(560px, 94vw); }
}

/* v1.19 Mobile fullscreen board */
@media (max-width: 640px){
  body.room .wrap{ padding: 0; }
  body.room .roomGrid{ gap: 0; }

  /* When viewing board, make it as large as possible */
  body.room #cardBoard{ border-radius: 0; }
  body.room #cardBoard .card__head{ display:none; }
  body.room #cardBoard .card__body.board-shell{
    padding: 0;
    height: calc(100svh - var(--topbar-h, 56px));
    align-items: center;
  }
  body.room #boardCanvas{ display:block; }
}


.desktopOnly{display:block;}
@media (max-width: 768px){
  .desktopOnly{display:none !important;}
}
