/* ═══════════════════════════════════════════
   HOUSIE – style.css  (Aqua Blue Theme)
   ═══════════════════════════════════════════ */

:root {
  --primary:  #00bcd4;
  --primary2: #0077b6;
  --accent:   #00e5ff;
  --green:    #00897b;
  --bg:       #020c1b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

#stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.star  { position: absolute; color: #00e5ff; font-size: 10px; opacity: .2; animation: twinkle 3s infinite; }

@keyframes twinkle   { 0%,100%{opacity:.15;transform:scale(1)} 50%{opacity:.9;transform:scale(1.5)} }
@keyframes pulse     { 0%,100%{transform:scale(1)} 50%{transform:scale(1.06)} }
@keyframes slideDown { from{transform:translateY(-30px);opacity:0} to{transform:translateY(0);opacity:1} }
@keyframes pop       { 0%{transform:scale(.7);opacity:0} 70%{transform:scale(1.08)} 100%{transform:scale(1);opacity:1} }
@keyframes bounce    { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }

/* ── Screens ── */
.screen { display: none; position: relative; z-index: 1; }
#game-screen { display: none; }

/* ── Card ── */
.card {
  background: rgba(0,188,212,.07);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0,229,255,.15);
  border-radius: 28px;
  padding: 40px 32px;
  max-width: 480px;
  margin: 40px auto;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,188,212,.15);
  animation: slideDown .4s ease;
}

.logo-emoji { font-size: 56px; display: block; margin-bottom: 8px; animation: bounce 2s infinite; }
.main-title { font-family: 'Fredoka One', cursive; font-size: 46px; color: #fff; letter-spacing: 3px; margin-bottom: 6px; }
.sub-text   { color: rgba(255,255,255,.55); font-size: 14px; margin-bottom: 28px; }
.info-note  { color: rgba(0,229,255,.6); font-size: 13px; margin-bottom: 14px; text-align: left; }

input[type=text],input[type=number] {
  width: 100%;
  background: rgba(0,188,212,.1);
  border: 1.5px solid rgba(0,229,255,.25);
  border-radius: 14px;
  padding: 13px 18px;
  color: #fff;
  font-size: 16px;
  font-family: 'Nunito', sans-serif;
  outline: none;
  margin-bottom: 14px;
  transition: border .2s;
}
input:focus        { border-color: var(--accent); }
input::placeholder { color: rgba(255,255,255,.3); }

.btn {
  display: block; width: 100%; padding: 14px;
  border: none; border-radius: 14px;
  font-family: 'Fredoka One', cursive; font-size: 17px; letter-spacing: 1px;
  cursor: pointer; transition: transform .15s; color: #fff;
}
.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-gold   { background: linear-gradient(135deg,#00bcd4,#0077b6); box-shadow: 0 4px 20px rgba(0,188,212,.45); }
.btn-purple { background: linear-gradient(135deg,#0096c7,#023e8a); box-shadow: 0 4px 20px rgba(0,150,199,.45); }
.btn-green  { background: linear-gradient(135deg,#00897b,#004d40); box-shadow: 0 4px 20px rgba(0,137,123,.4); }

.err-box  { background: rgba(229,57,53,.18); border: 1px solid #e53935; color: #ff8a80; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }

.code-box   { background: linear-gradient(135deg,rgba(0,188,212,.12),rgba(0,119,182,.08)); border: 2px dashed var(--primary); border-radius: 18px; padding: 20px; margin-bottom: 24px; }
.code-label { color: rgba(255,255,255,.55); font-size: 13px; display: block; margin-bottom: 6px; }
.code-value { font-family: 'Fredoka One', cursive; font-size: 40px; color: var(--accent); letter-spacing: 6px; display: block; }
.code-sub   { color: rgba(255,255,255,.4); font-size: 12px; display: block; margin-top: 4px; }

.divider { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.25); font-size: 13px; margin: 20px 0; }
.divider::before,.divider::after { content:''; flex:1; height:1px; background:rgba(0,229,255,.15); }

.section-title { color:#fff; font-size:17px; font-weight:800; margin-bottom:10px; text-align:left; }

/* ═══════════════════════════════════════
   DESKTOP GAME LAYOUT
   Sidebar LEFT (fixed width) | Tickets RIGHT (flex)
   ═══════════════════════════════════════ */
#game-screen {
  display: none;
  flex-direction: row;
  align-items: flex-start;
  min-height: 100vh;
  width: 100%;
}

/* ── Desktop Sidebar ── */
.sidebar {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  flex-shrink: 0;
  background: rgba(0,12,30,.85);
  backdrop-filter: blur(18px);
  border-right: 1px solid rgba(0,229,255,.1);
  padding: 22px 16px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-logo { font-family:'Fredoka One',cursive; font-size:24px; color:#fff; text-align:center; margin-bottom:4px; }
.room-tag     { text-align:center; color:var(--accent); font-size:13px; font-weight:700; margin-bottom:14px; }

.num-display  { background:linear-gradient(135deg,var(--primary),var(--primary2)); border-radius:18px; padding:16px 12px; text-align:center; margin-bottom:12px; box-shadow:0 4px 20px rgba(0,188,212,.4); }
.num-label    { color:rgba(255,255,255,.8); font-size:11px; font-weight:700; letter-spacing:1px; text-transform:uppercase; }
.num-big      { font-family:'Fredoka One',cursive; font-size:52px; color:#fff; line-height:1; animation:pulse .8s; }

.panel        { background:rgba(0,188,212,.06); border:1px solid rgba(0,229,255,.1); border-radius:12px; padding:11px; margin-bottom:10px; }
.panel-title  { color:rgba(0,229,255,.7); font-size:11px; font-weight:800; letter-spacing:.6px; text-transform:uppercase; margin-bottom:8px; }

.called-grid  { display:flex; flex-wrap:wrap; gap:3px; max-height:90px; overflow-y:auto; }
.called-chip  { background:rgba(0,229,255,.15); color:var(--accent); border-radius:5px; padding:2px 6px; font-size:11px; font-weight:800; }

.claim-row  { display:flex; justify-content:space-between; align-items:center; margin-bottom:5px; font-size:12px; }
.claim-key  { color:rgba(255,255,255,.55); }
.claim-who  { font-weight:800; color:var(--accent); }
.claim-none { font-weight:700; color:rgba(255,255,255,.2); }

.player-row  { display:flex; align-items:center; gap:8px; margin-bottom:6px; font-size:13px; color:rgba(255,255,255,.85); }
.dot         { width:8px; height:8px; border-radius:50%; background:#00e676; display:inline-block; flex-shrink:0; }
.host-badge  { background:var(--primary); color:#fff; border-radius:8px; padding:1px 8px; font-size:10px; font-weight:900; margin-left:auto; }

.waiting-msg     { color:rgba(0,229,255,.5); font-size:13px; text-align:center; margin-top:10px; }
.finished-banner { background:linear-gradient(135deg,var(--primary),var(--primary2)); color:#fff; border-radius:12px; padding:12px; text-align:center; font-weight:900; font-size:14px; margin-top:10px; animation:pulse 1s infinite; }

/* ── Desktop Tickets Area ── */
.tickets-area {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
  overflow-y: auto;
  min-height: 100vh;
}

.tickets-header { font-family:'Fredoka One',cursive; color:#fff; font-size:30px; margin-bottom:24px; }

/* ── Desktop Ticket Card ── */
.ticket-card {
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 24px;
  animation: pop .4s ease;
  max-width: 700px;
}

.ticket-top   { display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; }
.ticket-name  { font-family:'Fredoka One',cursive; font-size:24px; }
.ticket-badge { border-radius:20px; padding:4px 16px; font-size:14px; font-weight:800; color:#fff; }

.row-label-bar      { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.row-label          { font-size:13px; font-weight:800; min-width:60px; }
.row-complete-badge { border-radius:12px; padding:3px 12px; font-size:12px; font-weight:800; color:#fff; }

/* ── Desktop Ticket Grid ── */
.ticket-grid { display:grid; grid-template-columns:repeat(9,1fr); gap:8px; margin-bottom:14px; }

.cell {
  height: 56px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
  cursor: default; transition: all .15s;
  position: relative; user-select: none;
}
.cell.has-num           { cursor:pointer; border:2px solid rgba(0,0,0,.12); }
.cell.empty             { background:transparent !important; border:none !important; }
.cell.called-not-marked { border-style:dashed !important; cursor:pointer; }
.cell.marked            { color:#fff !important; }
.cell.marked::after {
  content:'✓'; position:absolute; top:-5px; right:-3px;
  font-size:10px; color:#fff; background:rgba(0,0,0,.3);
  border-radius:50%; width:15px; height:15px;
  display:flex; align-items:center; justify-content:center;
}

/* ── Toast ── */
#toast {
  position:fixed; top:24px; left:50%; transform:translateX(-50%);
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  color:#fff; padding:13px 30px; border-radius:50px;
  font-weight:900; font-size:17px; font-family:'Fredoka One',cursive;
  box-shadow:0 8px 32px rgba(0,188,212,.55);
  z-index:9999; display:none; animation:slideDown .3s ease;
  letter-spacing:1px; max-width:90vw; text-align:center;
}

::-webkit-scrollbar       { width:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(0,229,255,.2); border-radius:3px; }

/* ═══════════════════════════════════════
   MOBILE  (max-width: 768px)
   Sidebar TOP | Ticket BELOW
   ═══════════════════════════════════════ */
@media (max-width: 768px) {

  /* Stack vertically */
  #game-screen {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  /* Sidebar becomes full-width top panel */
  .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    position: relative !important;
    top: unset !important;
    border-right: none !important;
    border-bottom: 2px solid rgba(0,229,255,.15) !important;
    padding: 14px 14px 10px 14px !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
  }

  .sidebar-logo { display:none; }
  .room-tag     { font-size:12px; margin-bottom:8px; text-align:center; }

  /* Current number — horizontal compact */
  .num-display {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 14px !important;
    padding: 10px 16px !important;
    border-radius: 12px !important;
    margin-bottom: 8px !important;
  }
  .num-label { font-size:10px; white-space:nowrap; }
  .num-big   { font-size:34px; line-height:1; }

  /* Panels compact */
  .panel       { padding:8px 10px; margin-bottom:7px; border-radius:10px; }
  .panel-title { font-size:10px; margin-bottom:5px; }

  .called-grid { max-height:50px; gap:3px; }
  .called-chip { font-size:10px; padding:1px 5px; }

  .claim-row { font-size:11px; margin-bottom:3px; }

  /* Players horizontal */
  #sb-players { display:flex; flex-wrap:wrap; gap:5px; }
  .player-row {
    background:rgba(0,188,212,.08);
    border:1px solid rgba(0,229,255,.12);
    border-radius:20px; padding:3px 10px;
    font-size:11px; margin-bottom:0; gap:5px;
  }
  .host-badge  { font-size:9px; padding:1px 6px; }

  #start-btn       { padding:10px; font-size:14px; margin-top:8px !important; border-radius:10px; }
  .waiting-msg     { font-size:12px; margin-top:6px; }
  .finished-banner { font-size:13px; padding:10px; margin-top:8px; border-radius:10px; }

  /* Tickets area BELOW sidebar — full width */
  .tickets-area {
    width: 100% !important;
    padding: 16px 12px 30px 12px !important;
    flex: 1 !important;
    display: block !important;
  }

  .tickets-header { font-size:20px; margin-bottom:12px; }

  /* Mobile ticket card — full width */
  .ticket-card {
    padding: 14px !important;
    border-radius: 14px !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  .ticket-name  { font-size:17px !important; }
  .ticket-top   { margin-bottom:10px !important; }

  /* Mobile row labels */
  .row-label-bar { margin-bottom:4px; }
  .row-label     { font-size:11px; min-width:46px; }
  .row-complete-badge { font-size:10px; padding:2px 8px; }

  /* Mobile ticket grid — fit full width */
  .ticket-grid { gap:3px !important; margin-bottom:10px !important; }

  /* Mobile cells */
  .cell { height:36px !important; font-size:12px !important; border-radius:7px !important; }
  .cell.marked::after { width:12px; height:12px; font-size:8px; }

  /* Toast */
  #toast { top:14px; font-size:13px; padding:9px 18px; }

  /* Login/Lobby */
  .card       { margin:14px; padding:26px 18px; border-radius:20px; }
  .main-title { font-size:32px; }
  .logo-emoji { font-size:44px; }
  .code-value { font-size:28px; letter-spacing:4px; }
}

@media (max-width: 380px) {
  .cell { height:30px !important; font-size:10px !important; }
  .ticket-grid { gap:2px !important; }
  .num-big { font-size:28px; }
}

/* ── Jaldi 5 badge ── */
#jaldi5-badge {
  background: linear-gradient(135deg, #ff6f00, #ff8f00) !important;
  box-shadow: 0 2px 12px rgba(255,111,0,.5);
  margin-left: 8px;
}

/* ── Cell vibrate animation ── */
@keyframes vibrate {
  0%   { transform: translate(0,0) rotate(0deg); }
  15%  { transform: translate(-3px,2px) rotate(-1deg); }
  30%  { transform: translate(3px,-2px) rotate(1deg); }
  45%  { transform: translate(-2px,3px) rotate(0deg); }
  60%  { transform: translate(2px,-1px) rotate(1deg); }
  75%  { transform: translate(-1px,2px) rotate(-1deg); }
  90%  { transform: translate(2px,1px) rotate(0deg); }
  100% { transform: translate(0,0) rotate(0deg); }
}
.cell-vibrate {
  animation: vibrate 0.4s ease !important;
}

/* ── Jaldi 5 claim row highlight ── */
.claim-row:first-child .claim-who {
  color: #ff8f00 !important;
  font-size: 13px;
}

/* ── Resume dialog buttons hover ── */
#resume-yes:hover { opacity: .9; transform: translateY(-1px); }
#resume-no:hover  { background: rgba(255,255,255,.13) !important; }
