
    :root {
      --bg: #0f172a;      /* slate-900 */
      --panel: #111827;   /* gray-900 */
      --ink: #e5e7eb;     /* gray-200 */
      --ink-dim: #9ca3af; /* gray-400 */
      --brand: #7c3aed;   /* violet-600 */
      --ok: #10b981;      /* emerald-500 */
      --bad: #ef4444;     /* red-500 */
      --tile: #0b1020;    /* deep panel */
      --tile-border: rgba(255,255,255,0.18);
      --title-tile-size: 52px;        /* same as puzzle tiles */
      --title-tile-drop: 2px;         /* how much lower the square is drawn */
      --ui-scale: 1;              /* <-- add this */
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
      background: radial-gradient(1000px 600px at 50% -20%, #1f2937, var(--bg));
      color: var(--ink);
    }

    /* Allow gentle horizontal panning when long words overflow */
html, body {
  overflow-x: auto;
  overscroll-behavior-x: contain; /* smoother feel on iOS/Android */
}

/* Keep the puzzle board scaling centered */
.wrap {
  transform-origin: top center;
}

    /* Wider overall layout so the grey card feels bigger */
    .wrap { max-width: 1100px; margin: 24px auto; padding: 16px; }

.header {
  position: relative;
  display: flex;
  justify-content: center;   /* center only the title */
  margin-bottom: 16px;
}

/* Keep the title above the mask */
.title { position: relative; z-index: 3; }

/* (Optional) push the badge below the mask layer */
#dictBadge { position: relative; z-index: 1; }

.title {
  display: flex;
  align-items: center;
  gap: 6px;                  /* tighten spacing between S / E tiles and PELLABBL */
  font-weight: 900;
  font-size: clamp(28px, 5vw, 40px);
  user-select: none;
  text-align: center;
  position: relative;        /* ensure title text is anchor */
  z-index: 1;
}

#dictBadge {
  display: none !important;            /* or: opacity: 0; pointer-events: none; */
}

/* The word in the middle keeps the wide letter spacing */
.titleWord {
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

/* S / E tiles: perfectly centered, square, same color as title text */
/* S/E letters stay on the text baseline; the square is drawn with ::before */
.titleTile{
  position: relative;
  display: inline-block;          /* keeps the baseline aligned with PELLABBL */
  font: inherit;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0;
  margin: 0;
}

/* Draw the square (same size as puzzle tiles), nudged lower */
.titleTile::before{
  content: "";
  position: absolute;
  width: var(--title-tile-size);
  height: var(--title-tile-size);
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + var(--title-tile-drop)));
  border: 2px solid currentColor; /* same color as title text */
  border-radius: 6px;
  background: transparent;
  pointer-events: none;           /* clicks pass through */
}

/* Balanced spacing so the tiles sit like letters */
.titleTile:first-child { margin-right: 0.4em; }
.titleTile:last-child  { margin-left: 0.15em; }


   /* Ensure the entire card content is centered relative to the page */
.card {
  display: flex;
  flex-direction: column;
  align-items: center;   /* center children horizontally */
  transform: scale(var(--ui-scale));
  transform-origin: top center;
  will-change: transform;
}

.muted { color: var(--ink-dim); font-size: 14px; margin: 4px 0; } 
.card > .muted {
  margin-bottom: 0;
  text-align: left;
  align-self: flex-start;

  width: 100%;
  max-width: 800px;       /* match grid max-width */
  margin-left: auto;      /* center block horizontally */
  margin-right: auto;
  padding-left: 0;        /* no extra padding */
}


/* Small utility bar styling */
.zoomBar{
  display:flex; align-items:center; gap:8px;
  justify-content:center;
  margin:10px 0 0;
}
.zoomBar .check{ height:40px; padding:8px 12px; }
.zoomBar .muted{ min-width:56px; text-align:center; font-weight:700; }

/* Center the puzzle rows directly */
.board {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;   /* center puzzle rows as a block */
  justify-content: center;
  width: 100%;
}

.row {
  display: flex;
  align-items: center;
  justify-content: center; /* center tile group */
  gap: 10px;
  margin: 16px 0;
  position: relative;
}

.messages {
  position: absolute;
  right: -50px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 44px;
  text-align: center;
  font-weight: 900;   /* <-- make row scores bold */

  display: flex;
  flex-direction: column;
  align-items: center;
}

.rowScore{
  font-size: 22px;
  line-height: 1;
}

.maxHint {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
}

    .boardWrap { min-height: 46vh; display:flex; flex-direction:column; align-items:center; justify-content:center; }
    
    .tiles { display:flex; align-items:center; gap:8px; }
    .tile {
      width: 54px; height: 54px;
      border: 2px solid var(--tile-border);
      display:grid; place-items:center;
      font-weight:800; font-size: 24px; text-transform: uppercase;
      background: var(--tile); border-radius: 6px;
    }
    .tile.fixed { opacity: 0.95; }
    .tile.correct { background: #065f46; border-color: #10b981; color: #eafff4; }

    .midBox { position: relative; min-width: 54px; min-height: 54px; display:flex; align-items:center; }
    .midTiles { display:flex; align-items:center; gap:8px; min-height:54px; }
    .midInput { position:absolute; inset:0; opacity:0; pointer-events:auto; border:none; background:transparent; color:transparent; caret-color:transparent; }
    .midBox:focus-within { box-shadow: 0 0 0 2px rgba(124,58,237,0.35); border-radius:8px; }
    .midBox.locked { outline: 2px dashed rgba(255,255,255,0.12); border-radius:8px; }

    .check {
      appearance:none; cursor:pointer;
      padding: 12px 16px; border-radius: 12px;
      border: 1px solid rgba(255,255,255,0.12);
      background: var(--brand); color: white; font-weight: 700;
      height:54px; display:flex; align-items:center; justify-content:center;
    }

    .ok { color: var(--ok); }
    .bad { color: var(--bad); }

   /* Stack panels vertically, scoring first, dictionary second */
.grid {
  display: grid;
  grid-template-columns: 1fr;   /* single column */
  gap: 16px;
  max-width: 800px;
  width: 100%;
}

.grid > .panel:nth-child(1) {   /* Dictionary */
  grid-row: 2;                  /* goes second */
}

.grid > .panel:nth-child(2) {   /* How scoring works */
  grid-row: 1;                  /* goes first */
}

.site-footer{
  max-width:1100px;
  margin:24px auto 8px;
  padding:12px 16px;
  color:var(--ink-dim);
  font-size:12px;
  border-top:1px solid rgba(255,255,255,0.08);
  display:flex; align-items:center; justify-content:space-between;
  flex-wrap:wrap; gap:8px;
}
.footer-center{ flex:1; text-align:center; min-width:200px; }
.footer-left, .footer-right{ white-space:nowrap; }
.site-footer a{
  color:inherit; text-decoration:none; border-bottom:1px dotted rgba(255,255,255,0.25);
}
.site-footer a:hover{ border-bottom-color: rgba(255,255,255,0.6); }

@media (max-width:640px){
  .site-footer{ justify-content:center; text-align:center; }
  .footer-left, .footer-right{ width:100%; white-space:normal; }
}

@media (max-width: 720px) {
  .grid {
    grid-template-columns: 1fr;   /* stack panels on small screens */
    max-width: 400px;             /* keep it neat when stacked */
  }
}

.totalScore{
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--ok);
  min-width: 44px;
  text-align: center;
}

    .panel {
      background: #0b1020;
      border: 1px dashed rgba(255,255,255,0.12);
      border-radius: 16px;
      padding: 16px;
      margin:8px 0 0;
    }
    .badge { display: inline-block; padding: 4px 10px; border-radius: 999px; background: rgba(124,58,237,0.2); border: 1px solid rgba(124,58,237,0.35); color: #ddd; font-size: 12px; }
    .kvs { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; font-size: 14px; }
    
    #panelDictionary { 
    display: none; 
  }

    #dictBadge {
    display: none !important;
  }

  .site-footer{
  max-width: 1100px;
  margin: 24px auto 8px;
  padding: 12px 16px;
  color: var(--ink-dim);
  font-size: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display:flex; justify-content:space-between; align-items:center;
  flex-wrap:wrap; gap:8px;
}
.site-footer a{ 
  color:inherit; 
  text-decoration:none; 
  border-bottom:1px dotted rgba(255,255,255,0.25); 
}
.site-footer a:hover{ border-bottom-color: rgba(255,255,255,0.6); }

/* Page-wide reveal */
.app.is-loading { opacity: 0; }
.app.ready { opacity: 1; transition: opacity .22s ease; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .app.ready { transition: none; }
}

/* -----------------------
   Mobile polish (<= 480px)
   ----------------------- */
@media (max-width: 480px) {
  /* Use a fluid tile size instead of the fixed 54px */
  :root {
    /* ~46–54px depending on screen; keeps title squares in sync too */
    --title-tile-size: clamp(42px, 12.5vw, 54px);
  }

  /* Tighter outer layout */
  .wrap { padding: 12px; }

  /* Slightly smaller gaps so three rows fit comfortably */
  .row { gap: 8px; margin: 12px 0; }
  .tiles { gap: 6px; }

  /* Fluid tiles (match --title-tile-size so “S”/“E” header squares feel consistent) */
  .tile {
    width: var(--title-tile-size);
    height: var(--title-tile-size);
    font-size: calc(var(--title-tile-size) * 0.45);
  }

  .midBox {
    min-width: var(--title-tile-size);
    min-height: var(--title-tile-size);
  }
  .midTiles { min-height: var(--title-tile-size); gap: 6px; }

  /* Move the score/messages below the row to avoid clipping on small screens */
  .messages {
    position: static;
    transform: none;
    margin-top: 6px;
    min-width: 0;
    flex-direction: row;
    gap: 8px;
  }
  .rowScore { font-size: 18px; }

  /* Buttons row: wrap nicely and increase tap targets a bit */
  .check {
    min-height: 44px;
    padding: 10px 14px;
  }

  /* Avoid iOS zoom when focusing the hidden input */
  .midInput { font-size: 16px; }
}

/* Respect reduced motion at all sizes (keeps your existing fade-in behavior) */
@media (prefers-reduced-motion: reduce) {
  .app.ready { transition: none; }
}

/* Mobile submit button for each row */
.submitBtn {
  display: none;
  margin-left: 8px;
  height: 40px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  line-height: 1;
}

/* Show on touch devices (coarse pointers) */
@media (hover: none) and (pointer: coarse) {
  .submitBtn { display: inline-flex; align-items: center; justify-content: center; }
}

/* Reserve space so layout doesn't jump while JS builds puzzles */
.board { min-height: calc((54px + 32px) * 3); } /* tile height + vertical gap × 3 rows */
