/* The guide: the island's settings window as in 3.0. Its own title bar on Mica,
   a side bar (21% of the window, 240 to 320 wide) with a 32 tall search and
   34 tall tabs, the page's 28 px title, options on cards (12 of padding, 4
   apart), two on a line in a wide window; 14 px names over 12 px lines saying
   what they do. Under 900 wide the side bar keeps only the glyphs. */

.guide-page { height: 100svh; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.gwin {
  position: fixed; inset: clamp(0px, 2.2vw, 28px); max-width: 1560px; margin: 0 auto; display: flex; flex-direction: column;
  /* Mica: mostly the theme's base, a little of the wallpaper's color through it. */
  background: rgba(32, 32, 34, .9); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow);
  backdrop-filter: blur(80px) saturate(2); -webkit-backdrop-filter: blur(80px) saturate(2);
  animation: sw-in .5s cubic-bezier(.2, .8, .2, 1) both;
}
:root[data-theme="light"] .gwin { background: rgba(243, 243, 243, .92); }
/* Maximized: the whole screen, square corners. */
.gwin.max { inset: 0; max-width: none; border-radius: 0; border: 0; }
.gwin { transition: inset .25s cubic-bezier(.2, .8, .2, 1), border-radius .25s; }
/* Closing: it shrinks and fades; minimizing: it drops toward the bottom. */
.gwin.leaving { animation: none; pointer-events: none; transition: opacity .2s ease, transform .22s cubic-bezier(.4, 0, 1, 1); opacity: 0; }
.gwin.leaving.close { transform: scale(.97); }
.gwin.leaving.min { transform: translateY(40%) scale(.6); }
@keyframes sw-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@media (max-width: 760px) { .gwin { inset: 0; border-radius: 0; border: 0; } }

/* -------------------------------------------------------------- title bar */
.sw-title { display: flex; align-items: center; height: 40px; flex: none; font-size: 12px; color: var(--ink-2); user-select: none; }
.sw-back { width: 40px; height: 32px; margin: 0 2px 0 4px; display: grid; place-items: center; border-radius: 4px; color: var(--ink); text-decoration: none; flex: none; }
.sw-back::before { content: '\E72B'; font: 400 12px/1 var(--glyph); }
:root[data-glyphs="svg"] .sw-back::before { content: ''; width: 9px; height: 9px; border: solid currentColor; border-width: 0 0 1.5px 1.5px; transform: translateX(2px) rotate(45deg); }
.sw-back:hover { background: var(--card); }
.sw-app { display: inline-flex; align-items: center; gap: 12px; min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; }
.sw-app > span:not(.sw-tag) { overflow: hidden; text-overflow: ellipsis; }
.sw-tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent-bg); color: var(--accent); }
.sw-tools { display: flex; align-items: center; gap: 8px; margin: 0 8px; }
.sw-langbtn { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--line); border-bottom-color: var(--line-2); background: var(--card); color: var(--ink); font-size: 12.5px; }
.sw-langbtn:hover, .sw-langbtn[aria-expanded="true"] { background: var(--card-h); }
.sw-langbtn svg { width: 10px; height: 10px; color: var(--ink-2); }
.sw-globe::before { content: '\E774'; font: normal 400 14px/1 var(--glyph); }
:root[data-glyphs="svg"] .sw-globe { display: none; }
@media (max-width: 520px) { .sw-langbtn span { display: none; } }
.sw-title .tb-btns { align-self: stretch; }
.sw-title .tb-btns button { all: unset; display: grid; height: 100%; cursor: default; }
.sw-title .tb-btns i { width: 46px; height: 100%; }
.sw-title .tb-btns button:hover i { background: var(--card); color: var(--ink); }
.sw-title .tb-btns .tb-close:hover i { background: #c42b1c; color: #fff; }
.sw-title .tb-btns button:focus-visible i { outline: 2px solid var(--accent); outline-offset: -2px; }
.gwin.max .tb-btns [data-win="max"] i { font-size: 0; }
.gwin.max .tb-btns [data-win="max"] i::before { content: '\E923'; font: normal 10px/1 var(--glyph); }
@media (max-width: 760px) { .sw-title .tb-btns { display: none; } }

/* -------------------------------------------------------------- side bar */
.sw-body { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(240px, 21%, 320px) minmax(0, 1fr); }
.sw-nav { display: flex; flex-direction: column; min-height: 0; padding: 4px 0 0; }
.sw-search { position: relative; display: block; margin: 0 8px 14px 16px; flex: none; }
.sw-search input {
  all: unset; box-sizing: border-box; display: block; width: 100%; height: 32px; padding: 0 64px 0 12px; border-radius: 4px; font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-bottom-color: var(--line-2);
}
.sw-search input::placeholder { color: var(--ink-3); }
.sw-search input:focus { background: var(--bg); border-bottom: 2px solid var(--accent); }
.sw-search-g { position: absolute; right: 10px; top: 0; height: 32px; display: grid; place-items: center; pointer-events: none; color: var(--ink-2); }
.sw-search-g::before { content: '\E721'; font: 400 14px/1 var(--glyph); }
:root[data-glyphs="svg"] .sw-search-g::before { content: ''; width: 9px; height: 9px; border: 1.6px solid currentColor; border-radius: 50%; }
.sw-clear { position: absolute; right: 32px; top: 4px; width: 26px; height: 24px; border: 0; border-radius: 4px; background: none; color: var(--ink-2); display: grid; place-items: center; }
.sw-clear::before { content: '\E894'; font: 400 10px/1 var(--glyph); }
:root[data-glyphs="svg"] .sw-clear::before { content: '\00D7'; font: 16px/1 var(--sans); }
.sw-clear:hover { background: var(--card-h); }
.sw-clear[hidden] { display: none; }

.sw-tabs { flex: 1; min-height: 0; overflow-y: auto; padding: 0 4px 16px 8px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.sw-tab { position: relative; display: flex; align-items: center; gap: 16px; height: 34px; margin-bottom: 2px; padding: 0 12px; border-radius: 4px; color: var(--ink); text-decoration: none; font-size: 14px; white-space: nowrap; }
.sw-tab span { overflow: hidden; text-overflow: ellipsis; }
.sw-tab:hover { background: var(--card); }
.sw-tab:active { background: var(--mica-2); color: var(--ink-2); }
.sw-tab[aria-selected="true"] { background: var(--card-h); }
.sw-tab[aria-selected="true"]::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--accent); animation: sw-ind .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes sw-ind { from { transform: scaleY(0); } }
.sw-tab .fg { font-size: 16px; }
.sw-tab svg { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.sw-sep { margin: 13px 12px 8px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }

/* -------------------------------------------------------------- page */
.sw-page { min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 24px 40px 12px; outline: none; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
#content { max-width: 1500px; }
.sw-narrow-search:empty { display: none; }
.pg-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 2px 0 10px; }
.pg-head h1 { font: 600 28px/40px var(--disp); letter-spacing: 0; margin: 0; text-shadow: none; }
.pg-count { font-size: 12px; color: var(--ink-3); }
.pg-intro { margin: 0 0 12px; max-width: 75ch; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.pg-open { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 8px; padding: 12px 16px; border-radius: 4px; background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: 13px; color: var(--ink); max-width: 1100px; }
.pg-open p { margin: 0; line-height: 1.5; }
.pg-open .fg, .pg-open svg { font-size: 16px; width: 16px; height: 16px; color: var(--accent); margin-top: 2px; }
.pg-empty { color: var(--ink-2); padding: 24px 0; font-size: 14px; }

/* The island's preview, across the top (66 tall, its items in their order). */
.sw-preview { position: relative; height: 66px; margin: 0 0 12px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); background: url("https://images.unsplash.com/photo-1552394459-917cbbffbc84?w=1200&q=60&auto=format&fit=crop") 50% 18% / cover; }
.sw-preview .island-anchor.still { position: absolute; inset: 0; display: flex; justify-content: center; z-index: 0; pointer-events: none; }
.sw-preview .isl { display: block; padding-top: 18px; }
.sw-preview .seg { gap: 6px; padding: 0 12px; }

.sec-g { margin-top: 22px; }
.sec-g h2 { font: 600 14px/20px var(--sans); letter-spacing: 0; margin: 0 0 8px 2px; text-shadow: none; }
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; align-items: start; }
@media (min-width: 1240px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; } }
.cell { display: grid; gap: 2px; min-width: 0; }
/* One left alone takes the whole line, like in the mod (LineShare). */
.cards .cell:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* -------------------------------------------------------------- an option's card */
.opt { border-radius: 4px; background: var(--card); border: 1px solid var(--line); transition: background-color .15s, box-shadow .3s; min-width: 0; }
.opt.sub { margin-left: 28px; background: color-mix(in srgb, var(--card) 70%, transparent); }
.opt:hover { background: var(--card-h); }
.opt.glow { animation: glow 1.6s ease-out; }
@keyframes glow { 0%, 40% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 2px transparent; } }
.opt-head { all: unset; box-sizing: border-box; width: 100%; min-height: 68px; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 16px; gap: 16px; align-items: center; padding: 12px 16px; cursor: pointer; border-radius: 4px; }
.opt.sub .opt-head { min-height: 56px; }
.opt-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.opt-g { display: grid; place-items: center; color: var(--ink); }
.opt-g .fg { font-size: 16px; }
.opt-g svg { width: 10px; height: 10px; color: var(--ink-3); }
.opt-tx { min-width: 0; }
.opt-tx b { display: block; font-size: 14px; line-height: 20px; font-weight: 400; color: var(--ink); overflow-wrap: anywhere; }
.opt-tx small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; line-height: 16px; color: var(--ink-3); }
.opt.open .opt-tx small { -webkit-line-clamp: unset; display: block; }
.opt-chev { width: 12px; height: 12px; color: var(--ink-2); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.opt.open .opt-chev { transform: rotate(180deg); }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* Its control, drawn like the mod's (not clickable on the site). */
.opt-ctl { display: flex; align-items: center; justify-content: flex-end; font-size: 14px; color: var(--ink-2); max-width: 220px; }
.ctl-sw { display: inline-flex; align-items: center; gap: 12px; }
.tg { width: 40px; height: 20px; border-radius: 10px; border: 1px solid var(--ink-2); position: relative; flex: none; }
.tg::after { content: ''; position: absolute; top: 4px; left: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-2); }
.tg.on { background: var(--accent); border-color: var(--accent); }
.tg.on::after { left: auto; right: 3px; top: 3px; width: 12px; height: 12px; background: var(--accent-ink); }
.ctl-ch { display: inline-block; max-width: 220px; padding: 5px 30px 5px 11px; border-radius: 4px; background: var(--card); border: 1px solid var(--line); border-bottom-color: var(--line-2); font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.ctl-ch::after { content: ''; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border: solid var(--ink-2); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.ctl-sl { display: inline-flex; align-items: center; gap: 12px; font-size: 13px; white-space: nowrap; }
.ctl-sl i { width: 110px; height: 4px; border-radius: 2px; position: relative; background: linear-gradient(90deg, var(--accent) var(--p), var(--ink-3) var(--p)); }
.ctl-sl i::after { content: ''; position: absolute; left: var(--p); top: 50%; width: 12px; height: 12px; margin: -10px 0 0 -10px; border-radius: 50%; background: var(--accent); border: 4px solid var(--bg); box-shadow: 0 0 0 1px var(--line-2); }
.ctl-go { width: 12px; height: 12px; color: var(--ink-2); }

.opt-more { padding: 0 16px 14px 52px; border-top: 1px solid var(--line); animation: more .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes more { from { opacity: 0; transform: translateY(-4px); } }
.opt-more dl { display: grid; grid-template-columns: minmax(84px, max-content) minmax(0, 1fr); gap: 8px 18px; margin: 12px 0 10px; font-size: 13px; }
.opt-more dt { color: var(--ink-3); padding-top: 1px; }
.opt-more dd { margin: 0; min-width: 0; color: var(--ink); }
.opt-more p { margin: 0; line-height: 1.55; max-width: 72ch; overflow-wrap: anywhere; }
.crumb { color: var(--ink-2); }
.sub-note { color: var(--ink-3); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.chips li { padding: 2px 9px; border-radius: 4px; background: var(--card); border: 1px solid var(--line); font-size: 12.5px; }
.chips li.is-def { border-color: var(--accent); color: var(--accent); }
.opt-link { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 6px; margin-left: -6px; border-radius: 4px; font-size: 12px; color: var(--accent); }
.opt-link:hover { background: var(--card); }
.opt-link svg { width: 14px; height: 14px; }
.opt-link.done { color: var(--green); }

/* -------------------------------------------------------------- narrow: glyphs only */
@media (max-width: 900px) {
  .sw-body { grid-template-columns: 60px minmax(0, 1fr); }
  .sw-nav { padding-top: 8px; }
  .sw-tabs { padding: 0 6px 16px; }
  .sw-tab { justify-content: center; padding: 0; gap: 0; }
  .sw-tab span { display: none; }
  .sw-sep { margin: 10px 8px 8px; padding-top: 0; font-size: 0; }
  .sw-page { padding: 0 12px 32px 8px; }
  .sw-narrow-search .sw-search { margin: 4px 0 12px; }
  .opt-head { grid-template-columns: 16px minmax(0, 1fr) 12px; gap: 12px; padding: 12px; }
  .opt-ctl { grid-column: 2; grid-row: 2; justify-content: flex-start; max-width: none; }
  .opt-ctl:has(.ctl-go) { display: none; }
  .opt-chev { grid-column: 3; grid-row: 1; }
  .opt-more { padding: 0 12px 12px 40px; }
  .opt.sub { margin-left: 16px; }
}
@media (max-width: 520px) {
  .sw-body { grid-template-columns: 48px minmax(0, 1fr); }
  .sw-app > span:not(.sw-tag) { display: none; }
  .opt-more { padding-left: 12px; }
  .opt-more dl { grid-template-columns: 1fr; gap: 2px; }
  .opt-more dd { margin-bottom: 8px; }
  .sw-preview .seg { gap: 0; padding: 0 6px; }
  .sw-preview .isl-small, .sw-preview .wx-emoji { display: none; }
}
@media (prefers-reduced-motion: reduce) { .gwin, .opt-more, .sw-tab::before { animation: none !important; } }
