/* GG components: copied verbatim from entrypoints/options/style.css
   (base, glyphs, cards & rows, keycaps, segmented, switch, presets, skeletons, toast, splash).
   Keep in sync with the settings page. Site-only layout lives in site.css. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", "Segoe UI Variable Text", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}
/* ---------- Glyphs */
.glyph { display: inline-grid; place-items: center; flex-shrink: 0; width: 18px; height: 18px; }
.glyph svg { width: 100%; height: 100%; display: block; }
.tab-head > div { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: center; }
.tab-head > div > .note { grid-column: 1 / -1; }
.tab-icon {
  width: 44px; height: 44px; padding: 10px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.group-glyph {
  width: 30px; height: 30px; padding: 6px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.segmented .glyph { width: 15px; height: 15px; }
.eyebrow .glyph { width: 15px; height: 15px; color: var(--accent-text); }

/* ---------- Cards & rows */
.group {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  margin-bottom: 20px; box-shadow: var(--shadow); overflow: hidden;
}
.group-head { display: flex; align-items: center; gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--hair); }
.group-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.group-head > .switch { margin-left: auto; }
.group-head > div { flex: 1; min-width: 0; }
.group-desc { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 168px minmax(0,1fr) auto; align-items: center; gap: 18px; padding: 14px 22px; transition: background-color .15s; }
.row:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.row-general { grid-template-columns: minmax(0,1fr) auto; }
.row + .row, .rows-after { border-top: 1px solid var(--hair); }
.row-label { font-weight: 600; }
.row-desc { color: var(--muted); font-size: 13px; margin-top: 1px; }

/* Keycaps */
.keys { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
kbd {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px;
  font-size: 12px; font-weight: 600; color: var(--text);
  background: linear-gradient(var(--kbd-bg), color-mix(in srgb, var(--kbd-bg) 92%, var(--kbd-edge)));
  border: 1px solid var(--kbd-edge); border-radius: 7px;
  box-shadow: 0 2px 0 var(--kbd-edge), inset 0 1px 0 rgba(255,255,255,.5);
  transform: translateY(-1px);
}
.plus { color: var(--muted); font-size: 11px; }

/* ---------- Segmented (theme) */
.segmented { display: flex; flex-shrink: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500;
  padding: 5px 12px; border-radius: 7px; cursor: pointer; transition: background-color .2s, color .2s, box-shadow .2s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 0 0 1px var(--border); }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track {
  width: 40px; height: 24px; border-radius: 999px; background: var(--track-off); position: relative;
  transition: background-color .25s ease, box-shadow .25s ease;
}
.track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 999px;
  background: var(--thumb); box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), width .2s ease;
}
.switch:hover .track { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.switch:active .track::after { width: 22px; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch:active input:checked + .track::after { transform: translateX(12px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-weight: 600; }
.switch.master {
  padding: 8px 10px 8px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  box-shadow: var(--shadow); flex-direction: row-reverse;
}

#tab-shortcuts.disabled #groups { opacity: .4; filter: saturate(0); pointer-events: none; transition: opacity .2s; }

footer { display: flex; justify-content: flex-end; margin-top: 8px; }
footer button {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; padding: 9px 16px; cursor: pointer; font: inherit; font-weight: 500;
  transition: color .15s, border-color .15s, background-color .15s, transform .15s;
}
@media (hover: hover) and (pointer: fine) {
  footer button:hover { color: var(--text); border-color: var(--text); transform: translateY(-1px); }
  footer button:hover .glyph { transform: rotate(-40deg); }
}
footer button:active { transform: translateY(1px) scale(.985); transition-duration: 90ms; }
footer button .glyph { width: 16px; height: 16px; transition: transform .3s ease; }
footer button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Presets */
.presets-group { padding: 22px 22px 10px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.presets-desc { margin: 6px 0 18px; font-size: 13.5px; }
.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.preset {
  display: flex; flex-direction: column; gap: 12px; text-align: left; cursor: pointer;
  background: var(--card); color: var(--text); font: inherit;
  border: 1px solid var(--border); border-radius: 14px; padding: 8px 8px 12px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
@media (hover: hover) and (pointer: fine) {
  .preset:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); transform: translateY(-2px); }
}
.preset:active { transform: scale(.99); }
.preset.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.preset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.preset-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 6px; }
.preset-text { display: flex; flex-direction: column; gap: 1px; }
.preset-name { font-weight: 600; font-size: 15px; }
.preset-desc { color: var(--muted); font-size: 13px; }
.preset-check {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--track-off);
  display: grid; place-items: center; transition: background-color .2s, border-color .2s;
}
.preset.active .preset-check { background: var(--accent); border-color: var(--accent); }
.preset.active .preset-check::after {
  content: ""; width: 8px; height: 4.5px; margin-top: -2px;
  border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg);
}
.preset-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-height: 1.5em; margin: 12px 0 0; }
.preset-status .glyph { width: 15px; height: 15px; color: var(--accent-text); }

/* Skeleton previews (neutral; only the GG blue as accent) */
.skel {
  --s-bg: #eeeeea; --s-panel: #ffffff; --s-line: #dcdcd6; --s-strong: #8d8d92; --s-dot: #bdbdb8;
  --s-mark: #161618; --s-blue: #398eff; --s-pill: #b9d4ff; --s-star: #9a9aa0;
  display: flex; flex-direction: column; height: 132px; border-radius: 9px; overflow: hidden;
  background: var(--s-bg); border: 1px solid var(--hair);
}
:root[data-theme="dark"] .skel {
  --s-bg: #141416; --s-panel: #232327; --s-line: #38383e; --s-strong: #7b7b82; --s-dot: #4e4e55; --s-mark: #f5f5f3; --s-pill: #2c4f86; --s-star: #6a6a71;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .skel {
    --s-bg: #141416; --s-panel: #232327; --s-line: #38383e; --s-strong: #7b7b82; --s-dot: #4e4e55; --s-mark: #f5f5f3; --s-pill: #2c4f86; --s-star: #6a6a71;
  }
}
:where(.skel span) { display: block; flex-shrink: 0; }
.skel-top { display: flex; align-items: center; gap: 7px; padding: 8px 10px; }
.skel-menu { width: 9px; height: 6px; border-block: 1.5px solid var(--s-strong); }
.skel-logo { width: 10px; height: 10px; border-radius: 3px; background: var(--s-mark); }
.skel-search { width: 78px; height: 8px; border-radius: 999px; background: var(--s-line); }
.skel-icons { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.skel-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--s-dot); }
.skel-pill { width: 18px; height: 7px; border-radius: 999px; background: var(--s-pill); }
.skel-avatar { width: 9px; height: 9px; border-radius: 50%; background: var(--s-strong); }
.skel-body { flex: 1; display: flex; gap: 8px; padding: 0 0 0 6px; min-height: 0; }
.skel-rail { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.skel-nav { display: flex; flex-direction: column; gap: 5px; width: 28px; padding-top: 6px; }
.skel-nav-active { width: 16px; height: 4px; border-radius: 999px; background: var(--s-blue); }
.skel-nav-line { width: 16px; height: 4px; border-radius: 999px; background: var(--s-line); }
.skel-nav-line.short { width: 10px; margin-left: 4px; }
.skel-list { flex: 1; display: flex; flex-direction: column; gap: 3px; padding: 4px 0; min-width: 0; }
.skel-row { display: flex; align-items: center; gap: 6px; height: 18px; padding: 0 8px; border-radius: 3px; background: var(--s-panel); }
.skel-check { width: 5px; height: 5px; border-radius: 1px; border: 1px solid var(--s-dot); }
.skel-star { width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; border-bottom: 6px solid var(--s-star); }
.skel-sender { width: 40px; height: 4px; border-radius: 999px; background: var(--s-strong); }
.skel-subject { width: 78px; height: 4px; border-radius: 999px; background: var(--s-line); }
.skel-side { display: flex; flex-direction: column; gap: 8px; padding: 8px 6px 0; border-left: 1px solid var(--s-line); background: var(--s-bg); }
.skel-sq { width: 7px; height: 7px; border-radius: 2px; background: var(--s-dot); }
.skel-minimal .skel-body { padding-right: 10px; }
.skel-minimal .skel-list { gap: 0; background: var(--s-panel); border-radius: 5px; margin-bottom: 8px; padding: 2px 0; }
.skel-minimal .skel-row { border-radius: 0; }
.skel-minimal .skel-row + .skel-row { border-top: 1px solid var(--s-line); }

/* ---------- Toast */
.flash {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 10px 12px; border-radius: 12px; background: var(--text); color: var(--bg);
  font-size: 13.5px; font-weight: 500; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5);
  opacity: 0; transform: translate(-50%, 14px) scale(.98); pointer-events: none;
  transition: opacity .25s ease, transform .4s cubic-bezier(.2,.9,.25,1.2);
}
.flash.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.flash .glyph { width: 16px; height: 16px; color: var(--blue); }

/* ---------- Welcome splash */
html.welcoming .layout { visibility: hidden; }
.splash {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px 16px;
  background: var(--bg); overflow: hidden;
}
.splash[hidden] { display: none; }
.splash-glow {
  position: absolute; left: 50%; top: 42%; width: 760px; height: 760px; translate: -50% -50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--blue) 22%, transparent), transparent 70%);
  opacity: 0; scale: .4; pointer-events: none;
}
.splash-stage { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 540px; }
.splash-logo { overflow: visible; margin-bottom: 28px; filter: drop-shadow(0 18px 30px rgba(22,22,24,.28)); }
.sl-key, .sl-arrow, .sl-head { stroke-dasharray: 1; stroke-dashoffset: 1; }
.splash-title { margin: 0; font-size: 56px; line-height: 1; font-weight: 700; letter-spacing: -.02em; }
.splash-tag { margin: 12px 0 0; font-size: 22px; font-weight: 600; color: var(--text); }
.splash-tag span { display: inline-block; }
.splash-tag span:last-child { color: var(--accent-text); }
.splash-desc { margin: 18px 0 0; color: var(--muted); font-size: 15.5px; line-height: 1.55; max-width: 46ch; }
.splash-points { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 22px 0 0; padding: 0; }
.splash-points li {
  display: flex; align-items: center; gap: 7px; padding: 7px 12px 7px 10px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); font-size: 13px; font-weight: 500;
}
.splash-points .glyph { width: 16px; height: 16px; color: var(--accent-text); }
.splash-cta {
  margin-top: 30px; display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px 13px 26px;
  border: 0; border-radius: 999px; background: var(--blue); color: #fff; font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--blue) 80%, transparent), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease;
}
.splash-cta .glyph { width: 18px; height: 18px; transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
@media (hover: hover) {
  .splash-cta:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -12px color-mix(in srgb, var(--blue) 85%, transparent), inset 0 1px 0 rgba(255,255,255,.25); }
  .splash-cta:hover .glyph { transform: translateX(4px); }
}
.splash-cta:active { transform: translateY(1px) scale(.97); transition-duration: 80ms; }
.splash-cta:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.splash-fine { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }

/* Everything starts hidden, then plays in sequence. */
.splash :is(.splash-logo, .splash-title, .splash-tag span, .splash-desc, .splash-points li, .splash-cta, .splash-fine) { opacity: 0; }

.splash.play .splash-glow { animation: gg-glow 1.6s cubic-bezier(.2,.8,.2,1) .2s forwards; }
.splash.play .splash-logo { animation: gg-pop .75s cubic-bezier(.34,1.56,.64,1) .1s forwards, gg-press .38s cubic-bezier(.3,0,.3,1) 1.5s; }
.splash.play .sl-key { animation: gg-draw .85s cubic-bezier(.65,0,.35,1) .45s forwards; }
.splash.play .sl-arrow { animation: gg-draw .28s cubic-bezier(.5,0,.2,1) 1.1s forwards; }
.splash.play .sl-head { animation: gg-draw .26s cubic-bezier(.2,0,.2,1) 1.3s forwards; }
.splash.play .splash-title { animation: gg-title .8s cubic-bezier(.2,.8,.2,1) 1.55s forwards; }
.splash.play .splash-tag span { animation: gg-word .6s cubic-bezier(.2,.8,.2,1) forwards; }
.splash.play .splash-tag span:nth-child(1) { animation-delay: 1.75s; }
.splash.play .splash-tag span:nth-child(2) { animation-delay: 1.83s; }
.splash.play .splash-tag span:nth-child(3) { animation-delay: 1.91s; }
.splash.play .splash-tag span:nth-child(4) { animation-delay: 1.99s; }
.splash.play .splash-desc { animation: gg-rise .7s cubic-bezier(.2,.8,.2,1) 2.2s forwards; }
.splash.play .splash-points li { animation: gg-rise .6s cubic-bezier(.34,1.4,.64,1) forwards; }
.splash.play .splash-points li:nth-child(1) { animation-delay: 2.38s; }
.splash.play .splash-points li:nth-child(2) { animation-delay: 2.46s; }
.splash.play .splash-points li:nth-child(3) { animation-delay: 2.54s; }
.splash.play .splash-cta { animation: gg-rise .7s cubic-bezier(.34,1.56,.64,1) 2.7s forwards; }
.splash.play .splash-fine { animation: gg-fade .6s ease 2.95s forwards; }

.splash.leaving { animation: gg-out .65s cubic-bezier(.6,0,.4,1) forwards; pointer-events: none; }
.splash.leaving .splash-stage { animation: gg-stage-out .55s cubic-bezier(.6,0,.4,1) forwards; }

@keyframes gg-glow { to { opacity: 1; scale: 1; } }
@keyframes gg-pop { from { opacity: 0; transform: scale(.55) rotate(-10deg); } to { opacity: 1; transform: none; } }
@keyframes gg-press { 0%, 100% { translate: 0 0; scale: 1; } 40% { translate: 0 5px; scale: .95; } }
@keyframes gg-draw { to { stroke-dashoffset: 0; } }
@keyframes gg-title { from { opacity: 0; letter-spacing: .4em; filter: blur(8px); } to { opacity: 1; letter-spacing: -.02em; filter: none; } }
@keyframes gg-word { from { opacity: 0; transform: translateY(.55em); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes gg-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes gg-fade { to { opacity: 1; } }
@keyframes gg-out { to { opacity: 0; visibility: hidden; } }
@keyframes gg-stage-out { to { opacity: 0; transform: scale(1.04) translateY(-8px); filter: blur(4px); } }

/* Dashboard entrance after the splash */
.layout.reveal .sidebar { animation: gg-side-in .7s cubic-bezier(.2,.8,.2,1) .15s both; }
.layout.reveal main .tab:not([hidden]) > * { animation: gg-rise .6s cubic-bezier(.2,.8,.2,1) both; }
.layout.reveal main .tab:not([hidden]) > :nth-child(1) { animation-delay: .25s; }
.layout.reveal main .tab:not([hidden]) > :nth-child(2) { animation-delay: .33s; }
.layout.reveal main .tab:not([hidden]) > :nth-child(3) { animation-delay: .41s; }
.layout.reveal main .tab:not([hidden]) > :nth-child(4) { animation-delay: .49s; }
.layout.reveal main > footer { animation: gg-fade .5s ease .6s both; }
@keyframes gg-side-in { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .splash, .splash *, .layout.reveal, .layout.reveal * { animation: none !important; }
  .splash :is(.splash-logo, .splash-title, .splash-tag span, .splash-desc, .splash-points li, .splash-cta, .splash-fine) { opacity: 1; }
  .sl-key, .sl-arrow, .sl-head { stroke-dashoffset: 0; }
  .splash.leaving { display: none; }
}
@media (max-width: 520px) {
  .splash-title { font-size: 44px; }
  .splash-tag { font-size: 19px; }
  .splash-logo { width: 92px; height: 92px; }
}
