/* Keno Presets dropdown.
 *
 * IMPORTANT: this file lives as a static stylesheet (loaded via <link>
 * in keno.html) instead of being injected dynamically from keno.js.
 * The CSP header on this app declares `style-src 'self'`, which BLOCKS
 * dynamically-injected <style> elements (they're treated like inline
 * styles and need 'unsafe-inline'). When the rules were inside keno.js
 * the browser created the <style> tag but refused to apply its rules —
 * preset rows rendered as Windows-default white buttons, and the
 * `.keno-presets-dd { display: none }` rule was blocked too so the
 * dropdown never visually closed even though the JS was correctly
 * removing the .open class. Static .css files are allowed by 'self'.
 */

/* Wrap matches the panel's full-width button siblings. */
.keno-presets-wrap { position: relative; width: 100%; }

/* Layered ON TOP of `.gp-btn.secondary` (applied alongside this class)
   so the base padding/font/radius match Quick pick / Clear / Turbo /
   Play. Only the bits that make the presets button special live here:
   flex layout for chevron alignment, the chevron itself, and the
   polished active state when a preset is loaded. */
.keno-presets-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}
.keno-presets-btn .keno-presets-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.keno-presets-btn .keno-presets-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  opacity: .55;
  transition: transform .18s ease, opacity .15s ease;
  flex: 0 0 auto;
}
.keno-presets-btn:hover .keno-presets-chevron { opacity: .85; }
.keno-presets-btn.is-open .keno-presets-chevron { transform: rotate(180deg); opacity: 1; }
.keno-presets-btn .keno-presets-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--s-green);
  box-shadow: 0 0 6px rgba(0, 231, 1, .55);
  flex: 0 0 auto;
}
/* Active state — preset loaded. Subtle green-tinted background with a
   glowing border + green text. Pops just enough to read at a glance
   without screaming. */
.keno-presets-btn.has-active {
  background: rgba(0, 231, 1, .08);
  border-color: rgba(0, 231, 1, .55);
  color: var(--s-green);
  box-shadow: 0 0 0 1px rgba(0, 231, 1, .25), 0 4px 14px rgba(0, 231, 1, .10);
}
.keno-presets-btn.has-active:hover:not(:disabled) { background: rgba(0, 231, 1, .12); }

/* Dropdown card. */
.keno-presets-dd {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 240px;
  background: var(--s-bg-2);
  border: 1px solid var(--s-line);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .55);
  z-index: 100;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
}
.keno-presets-dd.open { display: block; }
.keno-presets-dd-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--s-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

/* ------- Preset row — name-only button, like a smaller Turbo. -------
   Real <button> element styled like .gp-btn.secondary (the same recipe
   Quick pick / Clear / Turbo use): dark face, line border, rounded
   corners. Smaller padding + smaller font than a full panel button so
   the dropdown shows several rows at a glance. */
.keno-preset-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  background: var(--s-bg-3);
  color: var(--s-text);
  border: 1px solid var(--s-line);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  user-select: none;
  text-align: center;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}
.keno-preset-item:hover { background: var(--s-bg-4); border-color: var(--s-muted-2); }
.keno-preset-item:active { transform: scale(.98); }
.keno-preset-item:focus-visible { outline: 2px solid var(--s-green); outline-offset: 2px; }
.keno-preset-item:last-child { margin-bottom: 0; }
/* Active preset — green border + green text + check badge. */
.keno-preset-item.active {
  border-color: var(--s-green);
  color: var(--s-green);
  background: var(--s-bg-3);
  box-shadow: 0 0 0 1px var(--s-green) inset;
}
.keno-preset-item.active:hover { background: var(--s-bg-4); }

/* The "tick" — small inline green badge with a crisp white SVG check. */
.keno-preset-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--s-green);
  color: #001a00;
  flex: 0 0 auto;
  box-shadow: 0 0 8px var(--s-green-glow);
}
.keno-preset-check svg { width: 10px; height: 10px; display: block; }

/* Pencil edit button — absolute-positioned on the right edge so the
   [check + name] cluster stays centered. Subtle at rest, lights up
   green on hover. Stop-propagation in JS prevents the click from
   bubbling to the row's "load preset" handler. */
.keno-preset-item { position: relative; }
.keno-preset-item-name { /* no-op slot — present so flex centering still works */ }
.keno-preset-edit {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  background: transparent;
  color: var(--s-muted);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .55;
  transition: opacity .15s, background .15s, color .15s, border-color .15s;
  font-family: inherit;
}
.keno-preset-edit svg { width: 12px; height: 12px; display: block; }
.keno-preset-item:hover .keno-preset-edit { opacity: 1; }
.keno-preset-edit:hover {
  background: rgba(127, 248, 0, .12);
  color: var(--s-green);
  border-color: rgba(127, 248, 0, .35);
}
/* Active row's pencil reads slightly differently — still subtle but
   doesn't fight the green active border. */
.keno-preset-item.active .keno-preset-edit { color: rgba(127, 248, 0, .7); }
.keno-preset-item.active .keno-preset-edit:hover { color: var(--s-green); }

/* ---------- Edit-mode banner ---------- */
/* Pinned to the top of the .gp-panel while a preset is being edited.
   Amber-accented to clearly signal "you're in a special editing
   state". Hidden when not editing. */
.keno-edit-banner {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(255, 204, 0, .14), rgba(255, 204, 0, .06));
  border: 1px solid rgba(255, 204, 0, .55);
  border-radius: 10px;
  box-shadow: 0 0 14px rgba(255, 204, 0, .15);
}
.keno-edit-banner.is-active { display: flex; }
.keno-edit-banner-text {
  font-size: 13px;
  color: var(--s-text);
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  line-height: 1.4;
}
.keno-edit-banner-prefix {
  color: rgba(255, 204, 0, .9);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .06em;
}
.keno-edit-banner-name {
  color: #ffcc00;
  font-weight: 800;
  font-size: 14px;
}
.keno-edit-banner-hint {
  color: var(--s-muted);
  font-size: 11px;
  font-weight: 500;
  flex-basis: 100%;
}
.keno-edit-banner-actions {
  display: flex;
  gap: 8px;
}
.keno-edit-banner-actions button {
  flex: 1;
  padding: 8px 12px;
  background: var(--s-bg-3);
  color: var(--s-text);
  border: 1px solid var(--s-line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
}
.keno-edit-banner-actions button:hover { background: var(--s-bg-4); border-color: var(--s-muted-2); }
.keno-edit-banner-actions .save {
  background: var(--s-green);
  color: #001a00;
  border-color: var(--s-green);
}
.keno-edit-banner-actions .save:hover:not(:disabled) {
  filter: brightness(1.08);
  background: var(--s-green);
  border-color: var(--s-green);
}
.keno-edit-banner-actions .save:disabled {
  opacity: .35;
  cursor: not-allowed;
  background: var(--s-bg-3);
  color: var(--s-muted);
  border-color: var(--s-line);
}

/* Empty-state placeholder. */
.keno-presets-empty {
  font-size: 12px;
  color: var(--s-muted);
  text-align: center;
  padding: 14px 8px 18px;
  font-style: italic;
}

/* ------- Save current button (centered at the bottom) -------
   Same .gp-btn.secondary recipe, smaller (matches the preset rows)
   and centered. Disabled state stays consistent with .gp-btn. */
.keno-preset-save-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--s-line);
}
.keno-preset-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--s-bg-3);
  color: var(--s-text);
  border: 1px solid var(--s-line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.keno-preset-save-btn:hover:not(:disabled) {
  background: var(--s-bg-4);
  border-color: var(--s-muted-2);
  color: var(--s-green);
}
.keno-preset-save-btn:disabled { opacity: .4; cursor: not-allowed; }
.keno-preset-save-btn .keno-preset-save-icon {
  font-size: 16px;
  line-height: 1;
  font-weight: 900;
}
.keno-preset-save-hint {
  font-size: 11px;
  color: var(--s-muted);
  text-align: center;
}

/* Inline name-input row that appears AFTER clicking Save current.
   Replaces the Save button briefly so the user can name the preset
   without leaving the dropdown. */
.keno-preset-name-row {
  display: flex;
  gap: 6px;
  width: 100%;
}
.keno-preset-name-row input {
  flex: 1;
  padding: 8px 10px;
  background: var(--s-bg);
  border: 1px solid var(--s-line);
  border-radius: 7px;
  color: var(--s-text);
  font-size: 12px;
  font-family: inherit;
  min-width: 0;
}
.keno-preset-name-row input:focus {
  outline: none;
  border-color: var(--s-green);
  box-shadow: 0 0 0 2px rgba(127, 248, 0, .2);
}
.keno-preset-name-row input::placeholder { color: var(--s-muted); }
.keno-preset-name-row button {
  padding: 6px 12px;
  background: var(--s-bg-3);
  color: var(--s-text);
  border: 1px solid var(--s-line);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.keno-preset-name-row button.confirm {
  color: var(--s-green);
  border-color: var(--s-green);
}
.keno-preset-name-row button:hover { background: var(--s-bg-4); }
