/* --- Basic reset / layout --- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

.grid-container {
  min-height: 100%;
  display: grid;
  place-items: center;           /* centers the grid on the page */
  background: #f7f7f9;
  padding: 16px;
}

/* --- Grid --- */
.word-grid {
  --cols: 8;                     /* change this if you change columns */
  width: min(90vmin, 800px);     /* responsive max width, stays square-ish */
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 8px;
  padding: 12px;
  background: white;
  border: 1px solid #e3e3ea;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

/* Make row wrappers transparent to the grid so squares become direct grid items */
.word-grid > [id^="row-"] {
  display: contents; /* lets children (.grid-square) participate in the parent grid */
}

/* --- Squares --- */
.grid-square {
  aspect-ratio: 1 / 1;           /* perfect squares without hardcoding height */
  background: #eef1f7;
  border: 2px solid #cbd3e1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 1rem/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #2c3e50;
  cursor: pointer;
  user-select: none;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.grid-square:hover {
  transform: translateY(-1px);
  background: #e6ebf6;
  border-color: #aeb8cc;
}

.grid-square:active {
  transform: translateY(0);
}

/* Keyboard focus visibility */
.grid-square:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(80, 120, 255, 0.35);
}
/* ===== Linkle state styling ===== */
.grid-square.given {
  background: #223a79;
  color: #fff;
  border-color: #223a79;
}
.grid-square.input {
  background: #dfe7ff;
  border-color: #b7c7ff;
}

#row-1 .grid-square,
#row-7 .grid-square {
  cursor: default;
}

.word-grid > [id^="row-"].active .grid-square {
  box-shadow: 0 0 0 2px rgba(80,120,255,.35) inset;
}

.word-grid > [id^="row-"].choosable .grid-square {
  border-color: #ff6a6a;
  background: #ffe9e9;
}
.word-grid > [id^="row-"].choosable:hover .grid-square {
  border-color: #ff3d3d;
  background: #ffdede;
  cursor: pointer;
}

.word-grid > [id^="row-"].solved .grid-square {
  background: #2a7f4f;
  border-color: #2a7f4f;
  color: #fff;
}

.grid-square.void {
   opacity: 1;
   pointer-events: none;
}

/* Void cells should still accept clicks so the row handler fires */
.grid-square.void { pointer-events: auto; }

/* shake on wrong guess */
@keyframes lk-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}
[id^="row-"].shake { animation: lk-shake 400ms ease; }

/* Points bar */
#points-bar {
  margin-top: 14px;
  font: 700 18px/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #1f2a44;
}
#points-bar .label { opacity: 0.7; margin-right: 8px; }

/* Toasts */
.lk-toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translate(-50%, -16px);
  background: #1f2a44;
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  opacity: 0;
  transition: 180ms ease;
  pointer-events: none;
  z-index: 50;
}
.lk-toast.ok { background: #2a7f4f; }
.lk-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Overlay / modal */
.lk-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: grid; place-items: center;
  z-index: 60;
}
.lk-modal {
  background: #fff; padding: 22px 24px; border-radius: 14px;
  width: min(90vw, 420px);
  text-align: center;
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
}
.lk-modal h2 { margin: 0 0 8px; font-size: 28px; }
.lk-modal p  { margin: 6px 0 18px; font-size: 18px; }
.lk-modal button {
  padding: 10px 16px; border-radius: 10px; border: none; cursor: pointer;
  background: #223a79; color: #fff; font-weight: 700;
}
.lk-modal button:hover { filter: brightness(1.1); }









/* Base style for revealed/given letters (keep it blue) */
.grid-square.given {
  background: #e6f0ff;     /* light blue */
  border-color: #6a90ff;   /* blue border */
  color: #0d2a6b;          /* dark blue text */
}

/* Keep given letters blue even when the row is choosable or active */
.word-grid > [id^="row-"].choosable .grid-square.given,
.word-grid > [id^="row-"].choosable:hover .grid-square.given,
.word-grid > [id^="row-"].active .grid-square.given {
  background: #e6f0ff !important;
  border-color: #6a90ff !important;
  color: #0d2a6b !important;
}

/* Solved still overrides everything to green */
.word-grid > [id^="row-"].solved .grid-square {
  background: #2a7f4f;
  border-color: #2a7f4f;
  color: #fff;
}







/* === Toasts: larger, clearer, themed === */
.lk-toast {
  position: fixed;
  left: 50%;
  top: 20px;
  transform: translateX(-50%) scale(.96);
  padding: 14px 18px;               /* bigger */
  font-size: 18px;                  /* bigger text */
  line-height: 1.2;
  font-weight: 700;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 22px rgba(0,0,0,.18);
  opacity: 0;
  z-index: 9999;
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}
.lk-toast.show { opacity: 1; transform: translateX(-50%) scale(1); }
.lk-toast.ok    { background: #2a7f4f; }  /* green */
.lk-toast.error { background: #b91c1c; }  /* red */
.lk-toast.info  { background: #374151; }  /* slate */






.grid-container,
.page,
#app {
  background: transparent;
}


/* Full-page gradient background */
:root {
  --site-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--site-bg);
  background-attachment: fixed; /* keeps the gradient steady on scroll */
}






/* One-letter-left selection:
   - All cells get light red background + GREY border
   - ONLY the final missing cell gets the RED border
*/
.word-grid > [id^="row-"].choosable.one-left .grid-square {
  background: #ffe6e6;
  border-color: #c9cbd1; /* grey like default */
}

/* Override any "given stays blue" rules for this special case */
.word-grid > [id^="row-"].choosable.one-left .grid-square.given {
  background: #ffe6e6 !important;
  border-color: #c9cbd1 !important;
  color: inherit; /* keep normal text color */
}

/* The single target slot */
.word-grid > [id^="row-"].choosable.one-left .grid-square.last-slot {
  border-color: #ff6a6a !important; /* red border */
}

/* Solved still wins */
.word-grid > [id^="row-"].solved .grid-square,
.word-grid > [id^="row-"].solved:hover .grid-square {
  background: #2a7f4f !important;
  border-color: #2a7f4f !important;
  color: #fff !important;
}








/* One-letter-left selection:
   - Non-given cells = light red + grey border
   - Given cells = stay blue (normal behavior)
   - Final missing cell = red border emphasis
*/
.word-grid > [id^="row-"].choosable.one-left .grid-square:not(.given) {
  background: #ffe6e6;
  border-color: #c9cbd1; /* grey like default */
}

.word-grid > [id^="row-"].choosable.one-left .grid-square.given {
  background: #e6f0ff !important;  /* keep the blue reveal */
  border-color: #6a90ff !important;
  color: #0d2a6b !important;
}

/* The single target slot (the last missing letter) */
.word-grid > [id^="row-"].choosable.one-left .grid-square.last-slot {
  background: #ffe6e6;               /* same light red backdrop */
  border-color: #ff6a6a !important;  /* red border highlight */
}

/* Solved still wins over everything */
.word-grid > [id^="row-"].solved .grid-square,
.word-grid > [id^="row-"].solved:hover .grid-square {
  background: #2a7f4f !important;
  border-color: #2a7f4f !important;
  color: #fff !important;
}





/* === Battle layout panels === */
.battle-layout {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  gap: 16px;
  align-items: start;
}
.panel {
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px;
  padding: 12px;
  color: #fff;
}
.panel-title { font-weight: 800; margin-bottom: 8px; opacity: .95; }
.score {
  font-size: 28px; font-weight: 900; margin-bottom: 10px;
}

/* Wager controls (left / me) */
.wagers.me .wager-btn {
  width: 100%; margin: 6px 0; padding: 10px 0;
  border-radius: 10px; border: 2px solid #c9cbd1;
  background: #f4f5f7; color: #111827; font-weight: 800;
  cursor: pointer;
}
.wagers.me .wager-btn.active {
  border-color: #6a90ff; background: #e6f0ff; color: #0d2a6b;
}
.wagers.me .wager-btn.disabled { opacity: .55; cursor: not-allowed; }

/* Wager indicator (right / opponent) */
.wagers.opp { display: grid; gap: 6px; }
.wager-pill {
  display: block; text-align: center; padding: 8px 0;
  border-radius: 10px; border: 2px solid #c9cbd1;
  background: #f4f5f7; color: #111827; font-weight: 800;
  opacity: .7;
}
.wager-pill.active {
  border-color: #f59e0b; background: #fff7ed; color: #7c2d12; opacity: 1;
}

/* Small status under grid if you want it visible */
.battle-status { color: #fff; font-weight: 700; margin-top: 10px; text-align: center; }
