:root {
    --app-w: 1400;
    /* design width */
    --app-h: 900;
    /* design height */
    --bg-outer: #041630;
    --panel: #071935;
    --accent: #7ee0ff;
    --accent2: #4fc3ff;
    --card: #082445;
    --glass: rgba(255, 255, 255, 0.03);
    --tile-hi: linear-gradient(180deg, #04139c, #0A1475);
    --tile-done: linear-gradient(180deg, #021627, #041425);
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--bg-outer);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    color: #e6f7ff
}

/* App container: fixed design size, scaled to fit viewport */
#app {
    width: calc(var(--app-w) * 1px);
    height: calc(var(--app-h) * 1px);
    transform-origin: 0 0;
    margin: 0 auto;
    position: relative;
    /* center by using flex on body */
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    background: linear-gradient(180deg, rgba(2, 10, 30, 0.25), rgba(0, 8, 20, 0.18));
}

/* Header / layout use REMs so they scale smoothly with transform */
header {
    display: flex;
    gap: 18px;
    align-items: center;
    margin: 0;
    padding: 8px 6px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.02));
    border-radius: 10px;
}

#topTitle {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
}

h1 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: 0.6px;
    color: var(--accent)
}


.topbar {
    margin-left: auto;
    display: flex;
    gap: 12px;
    align-items: center
}

.pill {
    background: linear-gradient(90deg, #012a4a, #023e73);
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    font-weight: 800;
    color: var(--accent)
}

.score {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.9rem
}

.player {
    display: flex;
    flex-direction: column;
    padding: 8px 14px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
    border: 1px solid rgba(255, 255, 255, 0.02)
}

.player strong {
    font-size: 1.1rem;
    color: var(--accent)
}

.current {
    box-shadow: 0 8px 30px rgba(79, 195, 255, 0.15);
    border: 1px solid rgba(79, 195, 255, 0.18);
    
}


main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex: 1 1 auto;
    min-height: 0;
}

/* board uses the design height instead of viewport so scaling is consistent */
.board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    flex: 1 1 auto;
    height: calc(100% - 120px);
    min-width: 0;
}

.category {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: 0 12px 40px rgba(0, 30, 60, 0.45);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#resetBtn {
    display: inline-flex;
    line-height: 1;
    white-space: nowrap;
    padding: 8px 12px;
    
}


.cat-head {
    font-weight: 900;
    
    min-height: 80px;
    font-size: 1rem;
    color: white;
    text-transform: uppercase;
    padding: 12px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.02));
    text-align: center;
    margin-bottom: 8px;
    box-shadow: inset 0 -6px 18px rgba(0, 0, 0, 0.08);
}

.cells {
    display: grid;
    grid-auto-rows: 1fr;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
}

/* Jeopardy-like tiles: sizes in rem so scaling via transform maintains proportions */
.cell {
    background: var(--tile-hi);
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    font-weight: 900;
    color: #D69F4C;
    font-size: 3.2rem;
    cursor: pointer;
    transition: transform .12s ease, opacity .12s ease, box-shadow .12s;
    border: 2px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 56px;
    box-shadow: 0 10px 30px rgba(3, 104, 197, 0.18), inset 0 -8px 24px rgba(0, 0, 0, 0.25);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.cell:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(3, 104, 197, 0.22), inset 0 -8px 24px rgba(0, 0, 0, 0.28)
}

.cell.done {
    background: var(--tile-done);
    color: #6e88a6;
    opacity: 0.65;
    cursor: default;
    transform: none;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.cell.small {
    height: 40px;
    font-size: 1rem
}

aside {
    width: 360px;
    background: linear-gradient(180deg, #022a4a, #001726);
    border-radius: 12px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 12px 40px rgba(0, 10, 30, 0.55);
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100% - 12px);
    overflow: auto;
    visibility: hidden;
}

.aside-head {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.muted {
    color: #9fb0d5;
    font-size: 0.9rem
}

.tracker {
    margin-top: 0;
    display: flex;
    gap: 8px;
    flex-direction: column;
    flex: 1 1 auto
}

.btn {
    display: inline-block;
    padding: 10px 12px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    color: #002;
    font-weight: 800;
    border: none;
    cursor: pointer
}

.btn.ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: #cfe6ff
}

.log {
    margin-top: 6px;
    background: linear-gradient(180deg, #012034, #021223);
    padding: 10px;
    border-radius: 8px;
    min-height: 120px;
    max-height: 300px;
    overflow: auto;
    font-size: 0.95rem;
    color: #bfeaff
}

.notice {
    padding: 10px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(79, 195, 255, 0.08), rgba(126, 224, 255, 0.03));
    color: #dff7ff;
    font-weight: 800
}

/* Modal stays positioned relative to scaled app */
.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(0, 8, 20, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    padding: 18px;
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s
}

.modal-back.show {
    opacity: 1;
    pointer-events: auto
}

.modal {
    
    height: 80%;
    border-radius: 12px;
    padding: 30px;
    
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 30px 60px rgba(0, 10, 30, 0.8);
    
    background: var(--tile-hi);
    display: flex;
    flex-direction: column;
    flex: 1 1 0;



}

.modal-input-row {
    margin-top: auto;
    display:flex;
    
    align-items:center;
}

.modal-input-row input {
    font-size: 1.5rem;
}

.modal h2 {
    margin: 0 0 10px;
    font-size: 2rem;
    color: var(--accent);
    
}

.qtext {
    font-weight: 800;
    padding-top: 20px;
    padding-bottom: 20px;
    height: 100%;
    color: #dff7ff;
    font-size: 3rem;
    text-align: center;
    align-content: center;
    
}


.small-muted {
    font-size: 0.9rem;
    color: #9fb0d5;
    margin-top: 8px
}

footer {
    margin-top: 12px;
    color: #9fb0d5;
    font-size: 0.95rem
}

.start-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
}

.start-modal-inner {
    width: 420px;
    max-width: 90%;
    background: var(--card);
    border-radius: 12px;
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 30px 60px rgba(0, 10, 30, 0.8)
}

#start_status {
    color: #9fb0d5;
    font-size: 0.9rem;
    margin-top: 8px;
}


#gameCodeScreen {
    position: absolute;
    visibility: hidden;
    width: 50%;
    transform: translateX(50%);
    font-size: 5rem;
    align-items: center;
    justify-content: center;
    text-align: center;

}

#joiningScreen {
    position: absolute;
    visibility: hidden;
    width: 50%;
    transform: translateX(50%);
    font-size: 5rem;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.loader-spinner{
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.12);
  border-top-color: var(--accent, #7ee0ff);
  animation: loader-spin 700ms linear infinite;
  box-sizing: border-box;
  display: inline-block;
  vertical-align: middle;
}
@keyframes loader-spin { to { transform: rotate(360deg); } }


@media (max-width:900px) {

    /* fallback small screens still scale the app; ensure modal width shrinks */
    .modal {
        width: 88%
    }
}

#current-question {
      border: 2px solid yellow;
}

#modal-current-player-indicator {
    font-size:13px;
    color:#9fb0d5;
}

