/* public/styles.css */
/* NYT/Wordle-ish: Clear Sans stack, green/yellow accents, neo-brutal borders + offset shadows, springy UI */

:root{
    /* Wordle-ish palette */
    --bg: #121213;
    --panel: #18181b;
    --panel2:#151517;
  
    --text: #f8f8f8;
    --muted: #b7b7b7;
    --muted2:#8f8f8f;
  
    --green: #6aaa64;
    --yellow:#c9b458;
    --danger:#f87171;
  
    /* Neo-brutal lines */
    --line: #2a2a2a;     /* border color */
    --ink: #111111;      /* offset shadow color (dark) */
  
    --radius: 12px;
    --stroke: 2px;
  
    /* Solid offset shadow */
    --lift: 12px 12px 0 var(--line);
  
    /* Springy easing */
    --spring: cubic-bezier(.2, 1.2, .25, 1);
  
    --maxw: 1200px;
  }
  
  *{ box-sizing:border-box; }
  html, body{ height:100%; }
  
  body{
    margin:0;
    color: var(--text);
    background: var(--bg);
  
    /* NYT Games / Wordle vibe: Clear Sans-ish stack */
    font-family:
      "Clear Sans",
      "Clear Sans Bold",
      "Helvetica Neue",
      Helvetica,
      Arial,
      ui-sans-serif,
      system-ui,
      -apple-system,
      Segoe UI,
      Roboto;
  }
  
  a{ color:inherit; }
  
  .sr-only{
    position:absolute !important;
    width:1px !important;
    height:1px !important;
    padding:0 !important;
    margin:-1px !important;
    overflow:hidden !important;
    clip:rect(0,0,0,0) !important;
    white-space:nowrap !important;
    border:0 !important;
  }
  
  .app{
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 18px 14px 22px;
  }
  
  /* ---------- Topbar ---------- */
  
  .topbar{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap: 12px;
    padding: 8px 2px 14px;
    border-bottom: var(--stroke) solid var(--line);
    margin-bottom: 14px;
  }
  
  .brand{
    display:flex;
    align-items:center;
    gap: 12px;
    min-width:0;
  }
  
  .logo{
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--green);
    border: var(--stroke) solid var(--line);
    box-shadow: 6px 6px 0 var(--line);
  }
  
  h1{
    font-size: 18px;
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.2px;
    line-height: 1;
  }
  
  .sub{
    margin-top: 3px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
  }
  
  /* Mode tabs */
  .modes{
    display:flex;
    gap: 10px;
    align-items:center;
  }
  
  .mode-btn{
    appearance:none;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 8px 6px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    border-bottom: var(--stroke) solid transparent;
    transition: transform .22s var(--spring), color .16s ease, border-color .16s ease;
  }
  
  .mode-btn:hover{
    color: var(--text);
    transform: translateY(-1px);
  }
  
  .mode-btn.is-active{
    color: var(--text);
    border-bottom-color: var(--yellow);
  }
  
  /* ---------- Layout ---------- */
  
  .layout{
    display:grid;
    grid-template-columns: 0.95fr 1.45fr;
    grid-template-rows: auto auto;
    gap: 14px;
    align-items: start;
  }
  
  .map-card{ grid-column: 1; grid-row: 1; }
  .controls-card{ grid-column: 1; grid-row: 2; }
  
  .painting-card{
    grid-column: 2;
    grid-row: 1 / span 2;
    display:flex;
    flex-direction: column;
    min-height: 620px;
  }
  
  /* ---------- Cards (neo-brutal) ---------- */
  
  .card{
    background: var(--panel);
    border: var(--stroke) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--lift);
    overflow:hidden;
  }
  
  .card-header{
    padding: 14px 14px 10px;
    border-bottom: var(--stroke) solid var(--line);
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap: 10px;
  }
  
  .round-meta{
    display:flex;
    align-items:center;
    gap: 10px;
    min-width:0;
  }
  
  .pill{
    display:inline-flex;
    align-items:center;
    padding: 5px 10px;
    border-radius: 999px;
    border: var(--stroke) solid var(--line);
    background: var(--panel2);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .3px;
  }
  
  .muted{ color: var(--muted); font-size: 11px; font-weight: 700; }
  .status{ color: var(--muted2); font-size: 11px; text-align:right; max-width: 55%; font-weight: 700; }
  
  /* ---------- Labels ---------- */
  
  .label-row{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap: 10px;
    padding: 12px 14px 10px;
  }
  
  .label{
    font-size: 12px;
    letter-spacing: .25px;
    color: var(--muted);
    font-weight: 900;
    text-transform: uppercase;
  }
  
  .hint{
    font-size: 11px;
    color: var(--muted2);
    text-align:right;
    font-weight: 700;
  }
  
  /* ---------- Map ---------- */
  
  .map{
    height: 190px;
    width: 100%;
    border-top: var(--stroke) solid var(--line);
    border-bottom: var(--stroke) solid var(--line);
  }
  
  .coords{
    padding: 10px 14px 12px;
    font-size: 11px;
    color: var(--muted);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
    font-weight: 700;
  }
  
  .map-actions{
    padding: 0 14px 14px;
    display:flex;
    justify-content:flex-end;
  }
  
  /* ---------- Controls ---------- */
  
  .controls-card{
    padding: 12px 14px 14px;
  }
  
  /* Focus on year: big, centered, "primary action" */
  .year-box{
    display:flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 10px;
  }
  
  #yearInput{
    width: 100%;
    max-width: 360px;
    text-align: center;
  
    padding: 14px 14px;
    border-radius: 14px;
  
    border: var(--stroke) solid var(--line);
    background: #0f0f10;
    color: var(--text);
  
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 1px;
  
    outline: none;
    box-shadow: 8px 8px 0 var(--line);
    transition: transform .22s var(--spring), box-shadow .22s var(--spring), border-color .16s ease;
  }
  
  #yearInput:focus{
    border-color: rgba(201,180,88,0.9);
    transform: translateY(-2px);
    box-shadow: 10px 10px 0 rgba(201,180,88,0.35);
  }
  
  /* Year range hint below, centered */
  .year-range{
    font-size: 12px;
    color: var(--muted2);
    font-weight: 800;
  }
  
  /* Slider: accent colors and crisp */
  .year-slider{
    width: 100%;
    margin: 10px 0 8px;
    accent-color: var(--yellow);
  }
  
  /* ---------- Buttons (springy “pop”) ---------- */
  
  .actions{
    display:flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    justify-content: center;
  }
  
  button{
    border: var(--stroke) solid var(--line);
    background: var(--panel2);
    color: var(--text);
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 6px 6px 0 var(--line);
    transition: transform .22s var(--spring), box-shadow .22s var(--spring), background .12s ease, opacity .12s ease;
    user-select:none;
  }
  
  button:hover{
    transform: translateY(-2px);
    box-shadow: 8px 8px 0 var(--line);
  }
  
  button:active{
    transform: translateY(2px);
    box-shadow: 4px 4px 0 var(--line);
  }
  
  button:disabled{
    opacity: 0.45;
    cursor: not-allowed;
    transform:none;
    box-shadow: 6px 6px 0 var(--line);
  }
  
  /* Primary uses Wordle green */
  .primary{
    background: var(--green);
    color: #0b0b0b;
    border-color: var(--line);
  }
  
  .primary:hover{
    filter: brightness(1.02);
  }
  
  /* Secondary uses Wordle yellow */
  .secondary{
    background: var(--yellow);
    color: #0b0b0b;
  }
  
  .ghost{
    background: transparent;
    color: var(--muted);
  }
  
  /* Error */
  .error{
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: var(--stroke) solid rgba(248,113,113,0.45);
    background: rgba(248,113,113,0.12);
    color: rgba(255,210,210,0.95);
    font-size: 12px;
    font-weight: 800;
  }
  
  /* ---------- Results ---------- */
  
  .results{
    margin-top: 12px;
    padding-top: 12px;
    border-top: var(--stroke) solid var(--line);
  }
  
  .results-row{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  
  .metric{
    padding: 10px 12px;
    border: var(--stroke) solid var(--line);
    background: #0f0f10;
    border-radius: 14px;
    box-shadow: 6px 6px 0 var(--line);
  }
  
  .metric-label{
    font-size: 11px;
    color: var(--muted2);
    margin-bottom: 6px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .3px;
  }
  
  .metric-value{
    font-size: 16px;
    letter-spacing: .2px;
    font-weight: 900;
  }
  
  .scoreline{
    margin-top: 10px;
    display:flex;
    align-items:stretch;
    justify-content:space-between;
    gap: 10px;
  }
  
  .score{
    min-width: 150px;
    padding: 10px 12px;
    border: var(--stroke) solid var(--line);
    background: #0f0f10;
    border-radius: 14px;
    box-shadow: 6px 6px 0 var(--line);
  }
  
  .score-label{
    font-size: 11px;
    color: var(--muted2);
    margin-bottom: 6px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .3px;
  }
  
  .score-value{
    font-size: 28px;
    letter-spacing: .4px;
    font-weight: 1000;
  }
  
  .breakdown{
    flex: 1;
    padding: 10px 12px;
    border: var(--stroke) solid var(--line);
    background: #0f0f10;
    border-radius: 14px;
    box-shadow: 6px 6px 0 var(--line);
    color: var(--muted);
    display:flex;
    align-items:center;
    font-weight: 800;
  }
  
  /* Details */
  .math{
    margin-top: 10px;
    border: var(--stroke) solid var(--line);
    border-radius: 14px;
    background: #0f0f10;
    overflow:hidden;
    box-shadow: 6px 6px 0 var(--line);
  }
  
  .math > summary{
    cursor:pointer;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--muted);
    user-select:none;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .3px;
  }
  
  .math-body{
    padding: 10px 12px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    color: var(--muted);
    white-space: pre-wrap;
    border-top: var(--stroke) solid var(--line);
  }
  
  /* ---------- Painting ---------- */
  
  .painting-head{
    padding: 14px 14px 10px;
    border-bottom: var(--stroke) solid var(--line);
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap: 12px;
  }
  
  .painting-title{
    font-size: 12px;
    letter-spacing: .25px;
    color: var(--muted);
    font-weight: 900;
    text-transform: uppercase;
  }
  
  /* Entrance animation for the painting */
  .painting-wrap{
    position: relative;
    flex: 1;
    min-height: 520px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding: 14px;
  }
  
  #paintingImg{
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
  
    border-radius: 14px;
    border: var(--stroke) solid var(--line);
    background: #0f0f10;
  
    box-shadow: var(--lift);
    transition: opacity .20s ease, transform .42s var(--spring);
    transform: translateY(8px) scale(0.985);
  }
  
  /* When image becomes visible (opacity set by JS), it "pops" in */
  #paintingImg[style*="opacity: 1"]{
    transform: translateY(0) scale(1);
  }
  
  #paintingImg:active{
    transform: translateY(1px) scale(0.997);
  }
  
  /* Skeleton: chunky and simple */
  .img-skeleton{
    position:absolute;
    inset: 14px;
    border-radius: 14px;
    background: #0f0f10;
    border: var(--stroke) dashed rgba(255,255,255,0.18);
    pointer-events:none;
  }
  
  /* ---------- Leaflet styling (match neo-brutal) ---------- */
  
  .leaflet-container{
    background: #0f0f10;
    outline: none;
  }
  
  .leaflet-control-zoom a{
    border-radius: 10px !important;
  }
  
  .leaflet-bar{
    border: var(--stroke) solid var(--line) !important;
    box-shadow: 6px 6px 0 var(--line) !important;
  }
  
  .leaflet-bar a,
  .leaflet-bar a:hover{
    background: var(--panel2) !important;
    color: var(--text) !important;
    border-bottom: var(--stroke) solid var(--line) !important;
  }
  
  .leaflet-control-attribution{
    background: transparent !important;
    color: var(--muted2) !important;
  }
  
  /* ---------- Responsive ---------- */
  
  @media (max-width: 980px){
    .layout{
      grid-template-columns: 1fr;
      grid-template-rows: auto;
    }
    .painting-card{
      grid-column: 1;
      grid-row: 1;
      min-height: 420px;
    }
    .map-card{
      grid-column: 1;
      grid-row: 2;
    }
    .controls-card{
      grid-column: 1;
      grid-row: 3;
    }
    .map{ height: 260px; }
    .status{ max-width: 100%; }
    #yearInput{ font-size: 30px; }
  }
  
  /* ---------- Reduced motion ---------- */
  @media (prefers-reduced-motion: reduce){
    *{ transition: none !important; animation: none !important; }
    #paintingImg{ transform:none !important; }
  }