:root {
  --bg1: #f5ebff;
  --bg2: #8c00ff;
  --tile-empty: #e6daf9;
  --tile-border: #cdb7f5;
  --tile-text: #1c112b;
  --key-bg: #eee7fb;
  --key-text: #2a1a40;
  --correct: #3aa394; /* green */
  --present: #d3ad69; /* yellow */
  --absent: #7a6a8f; /* gray */
  --card: #ffffff;
  --shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  --z-dev-power: 2147483647;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Inter,
    Arial,
    sans-serif;
  color: var(--tile-text);
}

/* === Web Weavers Wordle Scoped Styles === */
#weavers-wordle {
  --bg1: #f5ebff;
  --bg2: #8c00ff;
  --tile-empty: #e6daf9;
  --tile-border: #cdb7f5;
  --tile-text: #1c112b;
  --key-bg: #eee7fb;
  --key-text: #2a1a40;
  --correct: #3aa394;
  --present: #d3ad69;
  --absent: #7a6a8f;
  --card: #ffffff;
  --shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  /* responsive board sizing */
  --container: min(860px, 96vw); /* matches .wordle-app width */
  --pad: 16px; /* same as .wordle-card padding */
  --gap: 10px; /* same as grid gap */
  --tile-min: 18px; /* allows up to 12 tiles to fit on phones */
  --tile-max: 56px; /* still comfy on desktop */

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: calc(
    100vh - var(--site-header-height, 0px) - var(--site-footer-height, 0px)
  );
  background:
    radial-gradient(1200px 600px at 20% -10%, var(--bg2), transparent 60%),
    radial-gradient(1000px 600px at 110% 20%, #b56bff, transparent 50%),
    linear-gradient(180deg, #fdfbff, #efe7ff 60%, #f9f7ff);

  contain: paint; /* isolates painting of this section */
  /* content-visibility: auto; skip painting when offscreen */

  --z-base: 0;
  --z-ui: 100;
  --z-modal: 1000;
  --z-toast: 9999;
  --z-dev-power: 2147483647;
}

#weavers-wordle .wordle-app {
  width: min(860px, 96vw);
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Inter,
    Arial,
    sans-serif;
  color: var(--tile-text);
}

/* Header */
#weavers-wordle .wordle-header {
  text-align: center;
  margin-bottom: 16px;
}
#weavers-wordle .wordle-header h1 {
  margin: 0;
  letter-spacing: 0.12em;
  font-weight: 800;
}
#weavers-wordle .sub {
  opacity: 0.8;
  margin-top: 6px;
}

/* Card container */
#weavers-wordle .wordle-card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

/* Controls */
#weavers-wordle .wordle-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
#weavers-wordle .wordle-controls-left {
  display: flex;
  gap: 12px;
  align-items: center;
}
#weavers-wordle .badge {
  background: var(--bg2);
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}
#weavers-wordle select,
#weavers-wordle button {
  border: 1px solid #d9c9ff;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 600;
}
#weavers-wordle button.primary {
  background: var(--bg2);
  color: #fff;
  border-color: var(--bg2);
}

/* Grid */
#weavers-wordle .wordle-grid {
  /* tile size computed from columns, padding, and gaps */
  --tile: clamp(
    var(--tile-min),
    calc(
      (var(--container) - 2 * var(--pad) - (var(--cols, 5) - 1) * var(--gap)) /
        var(--cols, 5)
    ),
    var(--tile-max)
  );

  display: grid;
  gap: var(--gap);
  justify-content: center;
  margin: 18px auto;
  grid-template-columns: repeat(var(--cols, 5), var(--tile));
}
#weavers-wordle .tile {
  width: var(--tile);
  height: var(--tile);
  border: 2px solid var(--tile-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--tile) * 0.52);
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 12px;
  background: var(--tile-empty);
  transition:
    transform 0.12s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}
#weavers-wordle .tile.filled {
  border-color: #9b84f8;
}
#weavers-wordle .tile.flip {
  animation: wordle-flip 0.5s ease;
}
@keyframes wordle-flip {
  0% {
    transform: rotateX(0);
  }
  50% {
    transform: rotateX(-90deg);
  }
  100% {
    transform: rotateX(0);
  }
}
#weavers-wordle .tile.correct {
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
}
#weavers-wordle .tile.present {
  background: var(--present);
  border-color: var(--present);
  color: #fff;
}
#weavers-wordle .tile.absent {
  background: var(--absent);
  border-color: var(--absent);
  color: #fff;
}

/* Keyboard */
#weavers-wordle .wordle-keyboard {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(20, minmax(0, 1fr));
}
#weavers-wordle .key {
  grid-column: span 2;
  padding: 10px 0;
  background: var(--key-bg);
  color: var(--key-text);
  border: none;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 3px 0 #d6c9f7;
  cursor: pointer;
}
#weavers-wordle .key.wide {
  grid-column: span 4;
}
#weavers-wordle .key.correct {
  background: var(--correct);
  color: #fff;
}
#weavers-wordle .key.present {
  background: var(--present);
  color: #fff;
}
#weavers-wordle .key.absent {
  background: var(--absent);
  color: #fff;
}

/* Utility text */
#weavers-wordle .muted {
  opacity: 0.75;
}
#weavers-wordle a {
  color: var(--bg2);
  font-weight: 700;
}

/* Footer & tips */
#weavers-wordle .wordle-tip {
  text-align: center;
  margin-top: 12px;
  font-size: 0.9rem;
}
#weavers-wordle .wordle-footer {
  text-align: center;
  margin-top: 12px;
  font-size: 0.9rem;
}

/* Toast */
#weavers-wordle .toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  background: #231537;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
  z-index: var(--z-toast);
}
#weavers-wordle .toast.show {
  opacity: 1;
}
.weavers-wordle-small {
  font-size: xx-small;
  display: flex;
  justify-content: center;
}
#installBtn.is-hidden {
  display: none !important;
}
#wordle-btnGroup {
  margin-top: 10px;
  display: flex;
  gap: 12px;
}

.dict-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 12px;
}
.dict-total {
  font-weight: 600;
}
.dict-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  opacity: 0.8;
  cursor: pointer;
}
.dict-link:hover,
.dict-link:focus {
  opacity: 1;
  text-decoration: underline;
}

.dict-panel {
  width: 100%;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition:
    max-height 0.25s ease,
    opacity 0.25s ease;
}
.dict-panel.open {
  max-height: 12rem; /* enough for one/two lines; adjust as needed */
  opacity: 1;
}

.dict-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}
.dict-grid li {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
}
.dict-grid strong {
  font-weight: 700;
}
.dict-note {
  margin: 0.25rem 0 0;
  opacity: 0.7;
  font-size: 0.9em;
}
/* visibility */
.dict-odds[aria-hidden="true"] {
  display: none;
}
.dict-odds[aria-hidden="false"] {
  display: block;
}

/* optional styling */
.dict-odds {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(140, 0, 255, 0.06); /* brand purple tint */
  border: 1px solid rgba(140, 0, 255, 0.2);
}

#wordOdds h3 {
  margin: 0 0 8px 0;
  font-size: 1rem;
  font-weight: 700;
}

#wordOdds ul {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.35;
}
@media (max-width: 480px) {
  #weavers-wordle .key {
    box-shadow: none;
  }
}
.archive-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-dev-power);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 20, 24, 0.85);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.archive-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100vh;
  z-index: calc(var(--z-dev-power) - 1);
  background: rgba(14, 14, 18, 0.98);
  color: #fff;
  transform: translateX(100%);
  transition: transform 180ms ease;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
}

.archive-drawer.is-open {
  transform: translateX(0);
}

.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--brand);
}

.archive-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.archive-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.archive-content {
  padding: 12px 14px 20px;
  overflow: auto;
}

.archive-loading {
  opacity: 0.8;
  margin: 0;
}

/* Accordion-ish */
.archive-year,
.archive-month {
  margin: 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
}

.archive-year > button,
.archive-month > button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  /* border: none; */
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.archive-panel {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.archive-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 16px;
}

.archive-item .date {
  opacity: 0.85;
}

.archive-item .word {
  font-weight: 800;
  letter-spacing: 0.4px;
}

/* Today highlight */
.archive-item.is-today {
  outline: 2px solid var(--bg2);
}

/* Overlay */
.archive-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-dev-power) - 2);
  background: rgba(0, 0, 0, 0.45);
}
.title-note-archive {
  display: flex;
  flex-direction: column;
  gap: 0.35rem; /* subtle spacing */
}

.archive-title {
  font-size: 1.25rem; /* or whatever your h2 scale is */
  font-weight: 600;
  margin: 0;
}

.archive-note {
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0.7; /* visually de-emphasise */
  margin: 0;
}
