:root { 
    --bg: #0f1115;
    --panel: #171923;
    --text: #e6e8ef;
    --muted: #9aa3b2;
    --accent: #037c4a;
    --good: #5dd39e;
    --bad: #f18f97;
    --hl: rgba(155, 125, 60, 0.4);
    /* --hl: rgba(151, 75, 161, 0.18); */
    --hint: rgba(37, 125, 150, 0.4); 
    /*  --g: 10px;                  */
    --tile-min: 80px;         
    --tile-max: 80px;         
    --board-max: 60vw;  
    /* colors : red, blue, green, yellow, white, purple */     
    --p1: #ff6b6b; /* red */
    --p2: #6bd0ff; /* blue */
    --p3: #5dd39e; /* green */
    --p4: #ffd166; /* yellow */
    --p5: #e9edff; /* white */
    --p6: #a78bfa; /* purple */
}
  



html, body {
    height: 100%;
    width: 100%;
    /* background: radial-gradient(1200px 800px at 70% -10%, #1d2130, #1a131f); */
}

body {
    margin: 0;
    padding: 0;
    background: radial-gradient(1200px 800px at 70% -10%, #1d2130, #1a131f);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial;
    color: var(--text);
    display: grid;
    place-content: center;
    /* align-items: top; */
    /* display: block;  */
}

.app {
    width: min(1200px, 96vw);
    padding: 1px;
}

header {
    /* position: sticky; */
    /* top: 1000px; */
    margin-top: 15px;
    /* grid-template-columns: 1fr 100px; */
    display: flex;
    gap: 25px;
    /* align-items: center; */
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    padding: 16px 0;
}

.title {
    font-weight: 700;
    letter-spacing: .4px;
    font-size: clamp(18px, 2.2vw, 24px);
}

.sub {
    color: var(--muted);
    font-size: 13px;
}

.panel {
    background: linear-gradient(180deg, #1a1d29, #121521);
    border: 1px solid #24283a;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}

.board-wrap {
    display: grid;
    grid-template-columns: 1fr 310px;
    gap: 16px;
    margin-top: 6px;
    align-items: start;   
    justify-content: center;
    align-content: center;
    justify-self: left;
}


.board {
    justify-self: left;
    display: grid;
    gap: var(--g);            
    padding: 2px;
    grid-column: 2; 
    grid-row: 2;
    width: fit-content;                
    height: fit-content;
    max-width: 100%;    
    max-height: 100% ;
    background: #0a0c12;
    /* background: #037c4a; */
    border: 0;
    /* padding: 10px; */
    /* min-width: 40vw;     */
  }




.board-frame {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto 1fr auto;
    gap: var(--g);
    align-items: stretch;       
    justify-content: center;
    width: fit-content; 
    height: fit-content;
    padding: 2px;
    max-width: 65vw;            
    max-height: 60vh;
}






.labels { font: 12px/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #9aa3b2; }
.labels-top    { grid-column: 2; grid-row: 1; display: grid; justify-items: center; gap: 4px; margin-bottom: 3px;}
.labels-bottom { grid-column: 2; grid-row: 3; display: grid; justify-items: center; gap: 4px; margin-top: 3px; }
.labels-left,
.labels-right {
  grid-row: 2;
  display: grid;
  height: 100%;
  align-content: stretch;   
  align-items: stretch;     
  row-gap: var(--g);
  grid-auto-rows: 1fr;
}

.labels-left  { grid-column: 1; justify-items: end; margin-right: 3px; }
.labels-right { grid-column: 3; justify-items: start; margin-left: 3px;}
  



.labels-top > span, .labels-bottom > span { width: 1.8ch; text-align: center; opacity: .9; }
.labels-left > span,
.labels-right > span {
  display: flex;
  align-items: center;      /* vertical centering inside the stretched span */
  justify-content: flex-end;/* left rail text hugs the board */
  width: 2ch;
  height: 100%;
  opacity: .99;
}
.labels-right > span { justify-content: flex-start; } /* mirror for right rail */  




.tile {
    position: relative;
    background: radial-gradient(120% 120% at 30% 20%, #242230, #1a1f33 60%, #09192e 100%);
    border: 1px solid #2c3350;
    border-radius: 12px;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .15s ease, border-color .15s ease;
    display: grid;
    place-items: center;
    overflow: hidden;
    margin: 2px;
    padding: 1px;

    width: 90%;
    height: 90%;
    min-width: var(--tile-min);
    min-height: var(--tile-min);
    max-width: var(--tile-max);
    max-height: var(--tile-max);
    aspect-ratio: 1;
}




.tile:hover {
    /* transform: translateY(1px); */
    box-shadow: inset 0 0 0 200vmax var(--hl);
    /* border-color: var(--accent); */
}

.tile.disabled {
    opacity: .91;
    cursor: not-allowed;
}

.tile.disabled:hover {
    box-shadow: none;
}

.tile.highlight {
    outline: 2px dashed var(--accent);
    /* box-shadow: inset 0 0 0 200vmax var(--hl); */
}

.tile.hint {
    /* outline: 2px dashed var(--hint); */
    box-shadow: inset 0 0 0 200vmax var(--hint);
}

.symbols {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    text-align: center;
}

.sym-emoji {
    /* font-size:  clamp(20px, 2.4vw, 30px); */
    /* font-family: 'Noto Color Emoji'; */
    font-size: 36px;
    letter-spacing: -14px;
    line-height: 1;
    padding: 1px;
    padding-right: 10px;
    margin: 1px;color:  rgba(255, 255, 255, .9036);
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .06));
}

.sym-text {
    font-size: 10px;
    color: var(--text);
    /* letter-spacing: .1px; */
    margin-top: 10px;
}

.token {
    position: absolute;
    inset: 1px;
    border-radius: 25px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08), 0 6px 18px rgba(0, 0, 0, .6);
    display: grid;
    place-items: center;
    font-weight: 600;
    letter-spacing: .5px;
    text-shadow: 1px 1px 0 rgba(10, 0, 39, 0.86);
    color: #e8e9f7;    
}


/* tokens — lush candy-gloss gradients for each seat */

/* p1 — red (yours) */
.token.p1 {
    background: radial-gradient(120% 120% at 50% 33%,
      #ff8a8a,         /* lighter */
      #ff6b6b 66%,      /* base      */
      #e85b5b 90%      /* darker    */
    );
    border: 1px solid #e85b5b;
  }
  
.token.p1last {
    background: radial-gradient(120% 120% at 50% 33%,
        #ff8a8a00 25%,         /* lighter */
        #ff6b6b 66%,      /* base      */
        #e85b5b 90%     /* darker    */
    );
    border: 1px solid #e85b5b;
}

  /* p2 — blue (yours) */
  .token.p2 {
    background: radial-gradient(120% 120% at 50% 33%,
      #93e0ff,          /* lighter */
      #6bd0ff 66%,      /* base     */
      #4fb9ea 90%      /* darker   */
    );
    border: 1px solid #4fb9ea ;
  }

  .token.p2last {
    background: radial-gradient(120% 120% at 50% 33%,
      #93e0ff00 25%,          /* lighter */
      #6bd0ff 66%,      /* base     */
      #4fb9ea 90%      /* darker   */
    );
    border: 1px solid #4fb9ea ;
  }

  /* p3 — green (#5dd39e) */
  .token.p3 {
    background: radial-gradient(120% 120% at 50% 33%,
      #75daad,          /* lighter */
      #5dd39e 66%,      /* base     */
      #3fcb8c 90%      /* darker   */
    );
    border: 1px solid #3fcb8c ;
  }

  .token.p3last {
    background: radial-gradient(120% 120% at 50% 33%,
      #75daad00 25%,          /* lighter */
      #5dd39e 66%,      /* base     */
      #3fcb8c 90%      /* darker   */
    );
    border: 1px solid #3fcb8c ;
  }
  
  /* p4 — yellow (#ffd166) */
  .token.p4 {
    background: radial-gradient(120% 120% at 50% 33%,
      #ffda85,          /* lighter */
      #ffd166 66%,      /* base     */
      #ffc53f 90%      /* darker   */
    );
    border: 1px solid #ffc53f ;
  }

  .token.p4last {
    background: radial-gradient(120% 120% at 50% 33%,
      #ffda8500 25%,          /* lighter */
      #ffd166 66%,      /* base     */
      #ffc53f 90%      /* darker   */
    );
    border: 1px solid #ffc53f ;
  }
  
  /* p5 — white (#e9edff) */
  .token.p5 {
    background: radial-gradient(120% 120% at 50% 33%,
      #ffffff,          /* lighter */
      #e9edff 66%,      /* base     */
      #d7deff 90%      /* darker   */
    );
    border: 1px solid #c2cdff ;
  }

  .token.p5last {
    background: radial-gradient(120% 120% at 50% 33%,
      #ffffff00 25%,          /* lighter */
      #e9edff 66%,      /* base     */
      #d7deff 90%      /* darker   */
    );
    border: 1px solid #c2cdff ;
  }
  
  /* p6 — purple (#a78bfa) */
  .token.p6 {
    background: radial-gradient(120% 120% at 50% 33%,
      #bea9fb,          /* lighter */
      #a78bfa 66%,      /* base     */
      #8b66f8 90%      /* darker   */
    );
    border: 1px solid #8b66f8 ;
  }

  .token.p6last {
    background: radial-gradient(120% 120% at 50% 33%,
      #bea9fb00 25%,          /* lighter */
      #a78bfa 66%,      /* base     */
      #8b66f8 90%      /* darker   */
    );
    border: 1px solid #8b66f8 ;
  }

/* Inline-flex for KV value blobs */
.kv .v {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  
  /* Color dots for player/turn */
  .swatch {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--p1); /* default; JS can override inline */
  }
  
  /* Subtle section badges + spacing helpers */
  .badge-subtle { opacity: 0.8; }
  .mt-8 { margin-top: 8px; }
  
  /* Legend text tone */
  .legend {
    /* font-family:  'Georgia', 'Garamond', serif; */
    font-size: 13px;
    color: #9aa3b2;
    line-height: 1.2;
  }
  
  /* Log box behavior + mono font */
  #logBox {
    height: 180px;
    overflow: auto;
    white-space: pre-wrap;
  }
  
  .mono {
    font-family:
      ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
      "Liberation Mono", "Courier New", monospace;
  }
  

.legend-dot {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    border-radius: 50%;
    margin-right: 0.35em;
    vertical-align: -0.1em;
    border: 1px solid rgba(0,0,0,0.25);
}

.legend-chip {
    white-space: nowrap;
} 
  

.sidebar {
    min-width: 300px;
    max-width: 310px;
    padding: 12px;
    display: grid;
    gap: 7px;
    align-content: start;
}

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

.column {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
}

.pill {
    padding: 7px 12px;
    border-radius: 12px;
    background: #20253a;
    border: 1px solid #313a5b;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.kv {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.kv .k {
    opacity: .86;
}

.btn {
    appearance: none;
    border: 1px;
    border-radius: 12px;
    background: linear-gradient(180deg, #172c79, #180255);
    color: #e9edff;
    padding: 8px 12px;
    font-weight: 600;
    letter-spacing: .3px;
    cursor: pointer;
    border: 1px solid #3d4b83;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
    transition: transform .06s ease, filter .06s ease, box-shadow .06s ease;
}


.btn:hover {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}

.btn:disabled,
.btn.readonly {
  cursor: not-allowed;        /* or 'default' if you prefer */
  pointer-events: none;       /* kills hover altogether */
  transition: none;           /* no sneaky fades */
  transform: none;            /* stay put */
  filter: saturate(.87) brightness(.95);      /* optional: dim look */
}

.btn.active {
    background: linear-gradient(180deg, #636b86, #4a59a0);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .35);
    border-color: #4a59a0;
}

.status {
    padding: 10px 12px;
    border-radius: 12px;
    background: #1a1f31;
    border: 1px solid #2a345a;
}

.winner {
    color: var(--good);
    font-weight: 800;
}

.tiny {
    font-size: 12px;
    color: #9aa3b2;
}

#tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    background: #0b0e16;
    color: #eaf0ff;
    border: 1px solid #2a3357;
    border-radius: 10px;
    padding: 6px 8px;
    font-size: 12px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
    opacity: 0;
    transform: translate(-50%, -140%);
    transition: opacity .06s ease;
}

.seg {
    display: inline-flex;
    background: #1a1e2f;
    border: 1px solid #2a3257;
    border-radius: 12px;
    overflow: hidden;
}

.seg button {
    background: transparent;
    border: 0;
    color: #c9d2ff;
    padding: 8px 10px;
    cursor: pointer;
}

.seg button.active {
    background: #2a3353;
}

.controls {
    display: grid;
    min-width: 450px;
    gap: 8px;
}

.controls .row {
    gap: 8px;
}

.link { 
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; 
    padding: 6px 8px; 
    background: #0f172a; 
    border: 1px solid #334155; 
    border-radius: 8px; 
}

select {
    background: #1a1e2f;
    color: #e9edff;
    border: 1px solid #2a3257;
    border-radius: 10px;
    padding: 6px 10px;
}

label {
    font-size: 12px;
    color: #9aa3b2;
}

input[type=text] {
    background: #1a1e2f;
    color: #e9edff;
    border: 1px solid #2a3257;
    border-radius: 10px;
    padding: 6px 10px;
}


/* Boot overlay baseline */
.nick-overlay {
    position: fixed; inset: 0; display: none;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,.6);
    z-index: 9999;
  }
  .nick-overlay.show { display: flex; }
  
  .nick-modal {
    background: #fff; color: #111;
    padding: 20px 24px; border-radius: 16px;
    min-width: min(480px, 92vw);
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
  }
  
  .nick-input {
    width: 100%; padding: 12px 14px; font-size: 16px;
    border: 1px solid #ccc; border-radius: 10px; outline: none;
  }
  .nick-input:focus { border-color: #666; }
  
  .nick-actions { margin-top: 12px; display: flex; justify-content: flex-end; gap: 10px; }
  
  .btn.primary {
    padding: 10px 14px; border-radius: 10px; border: 0; cursor: pointer;
  }
  