:root {
  --edge: #8c6b3f;
  --gold: #c79736;
  --ink: #243044;
  --mist: #7f9a86;
  --paper: #f6ecd8;
  --paper-dark: #ead8b8;
  --panel: #d8c29c;
  --side: #efe2c9;
  --button: #fff8ea;
  --button-active: #ead6a9;
  --line: #d1bd92;
  --shadow: rgba(36, 48, 68, 0.18);
  --canvas-size: 100%;
  --grid-step: 34px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--panel);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

.simulator-page {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--button);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

button:hover,
button:focus-visible {
  background: #f4e3bd;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(199, 151, 54, 0.55);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 100vh;
}

.simulator-page .app-shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app-home-page .app-shell {
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.top-title {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 10px 18px;
  background: var(--ink);
  border-bottom: 3px solid var(--edge);
  padding-inline-end: 88px;
}

.top-title h1 {
  min-width: 0;
  margin: 0;
  color: var(--gold);
  font-size: clamp(1.35rem, 2.7vw, 2.25rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-home,
.page-title-link {
  color: inherit;
  text-decoration: none;
}

.brand-home h1,
.page-title-link h1 {
  transition: color 160ms ease;
}

.brand-home:hover h1,
.brand-home:focus-visible h1,
.page-title-link:hover h1,
.page-title-link:focus-visible h1 {
  color: #f0c96a;
}

.brand-home:focus-visible,
.page-title-link:focus-visible {
  outline: 3px solid rgba(199, 151, 54, 0.55);
  outline-offset: 4px;
  border-radius: 8px;
}

.brand-logo-image {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  display: block;
}

.community-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(260px, 30vw);
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: #fff4d6;
  font-family: var(--label);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.community-profile-pill:hover,
.community-profile-pill:focus-visible {
  background: rgba(199, 151, 54, 0.16);
  color: #fff8e7;
}

.community-profile-pill:focus-visible {
  outline: 3px solid rgba(199, 151, 54, 0.55);
  outline-offset: 3px;
}

.community-profile-pill > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.community-profile-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c79736;
  box-shadow: 0 0 0 2px rgba(199, 151, 54, 0.14);
}

.community-profile-pill[data-connected="true"] .community-profile-dot {
  background: #86a77f;
  box-shadow: 0 0 0 2px rgba(134, 167, 127, 0.14);
}

.project-support-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.project-support-pill {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 244, 214, 0.48);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.06);
  color: #fff4d6;
  font: 700 0.78rem var(--label);
  cursor: pointer;
  white-space: nowrap;
}

.project-support-pill:hover,
.project-support-pill:focus-visible { background: rgba(199, 151, 54, 0.18); }

.project-support-dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  padding: 0;
  border: 1px solid var(--gold);
  border-radius: 26px;
  background: #fff9eb;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(23, 34, 54, 0.3);
}

.project-support-dialog::backdrop { background: rgba(16, 24, 39, 0.62); backdrop-filter: blur(4px); }
.project-support-heading { display: flex; justify-content: space-between; gap: 20px; padding: 24px 26px 18px; border-bottom: 1px solid var(--paper-line); background: linear-gradient(135deg, #f5e4b5, #fff9eb 58%); }
.project-support-heading h2 { margin: 4px 0 0; font-size: clamp(1.7rem, 4vw, 2.6rem); }
.project-support-kicker { color: var(--warm-brown); font: 700 0.7rem var(--label); letter-spacing: 0.12em; text-transform: uppercase; }
.project-support-close { align-self: flex-start; width: 44px; height: 44px; border: 1px solid var(--warm-brown); border-radius: 50%; background: #fffaf0; color: var(--ink); font-size: 1.8rem; cursor: pointer; }
.project-support-copy { padding: 20px 26px 8px; font-size: 1.02rem; line-height: 1.65; }
.project-support-copy p { margin: 0 0 14px; }
.project-support-options { display: grid; gap: 10px; padding: 8px 26px 18px; }
.project-support-option { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 16px; border: 1px solid var(--paper-line); border-radius: 16px; background: rgba(246, 232, 194, 0.36); }
.project-support-option > div,
.project-support-option > span { display: grid; gap: 3px; }
.project-support-option small { color: var(--warm-brown); }
.project-support-donate,
.project-ad-disable { padding: 9px 14px; border: 1px solid var(--warm-brown); border-radius: 999px; color: var(--ink); background: #fffaf0; font-weight: 700; text-decoration: none; }
.project-support-donate.is-disabled { opacity: 0.5; pointer-events: none; }
.project-support-ad-choice input { width: 26px; height: 26px; accent-color: var(--gold); }
.project-support-note { margin: 0; padding: 0 26px 24px; color: var(--warm-brown); font-size: 0.82rem; line-height: 1.5; }

.simulator-ad-placement {
  position: fixed;
  z-index: 39;
  bottom: var(--grimoire-height, 52px);
  left: 50%;
  transform: translateX(-50%);
  grid-column: 1 / -1;
  width: min(970px, calc(100% - 24px));
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  background: rgba(255, 249, 235, 0.88);
  text-align: center;
}
.project-ad-frame { min-height: 60px; }
.project-ad-disable { margin-top: 7px; font-size: 0.75rem; cursor: pointer; }

.workshop-menu {
  position: absolute;
  z-index: 30;
  top: 6px;
  right: 12px;
  width: 56px;
  transition: width 180ms ease;
}

.workshop-menu.is-open {
  width: min(280px, calc(100vw - 24px));
}

.workshop-menu-toggle {
  display: grid;
  grid-template-columns: 32px 1fr 16px;
  align-items: center;
  width: 56px;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid rgba(199, 151, 54, 0.78);
  border-radius: 14px;
  background: var(--ink);
  color: var(--gold);
  box-shadow: 0 12px 28px rgba(16, 22, 34, 0.24);
  overflow: hidden;
  transition: width 180ms ease, background 160ms ease;
}

.workshop-menu.is-open .workshop-menu-toggle {
  width: 100%;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.workshop-menu-toggle:hover,
.workshop-menu-toggle:focus-visible {
  background: #2c3a52;
}

.workshop-menu-toggle:focus-visible {
  outline-color: var(--gold);
}

.workshop-menu-toggle img {
  display: block;
  width: 32px;
  height: 32px;
}

.workshop-menu-toggle-label,
.workshop-menu-toggle-chevron {
  opacity: 0;
  white-space: nowrap;
  transition: opacity 120ms ease;
}

.workshop-menu.is-open .workshop-menu-toggle-label,
.workshop-menu.is-open .workshop-menu-toggle-chevron {
  opacity: 1;
}

.workshop-menu-toggle-label {
  padding-inline: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: start;
}

.workshop-menu-toggle-chevron {
  font-size: 1.15rem;
  line-height: 1;
}

.workshop-menu-panel {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: calc(100vw - 24px);
  margin-top: 4px;
  padding: 10px;
  border: 1px solid rgba(140, 107, 63, 0.68);
  border-radius: 8px 8px 14px 14px;
  background: var(--side);
  box-shadow: 0 22px 46px var(--shadow);
}

.workshop-menu-panel[hidden] {
  display: none;
}

.workshop-menu-heading {
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.workshop-menu-links {
  display: grid;
  gap: 6px;
}

.workshop-menu .header-link {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--button);
  color: var(--ink);
}

.workshop-menu .header-link:hover,
.workshop-menu .header-link:focus-visible {
  background: var(--button-active);
}

.workshop-menu .language-switcher {
  justify-self: start;
}

.language-switcher {
  display: inline-grid;
  grid-template-columns: repeat(2, 44px);
  min-height: 44px;
  overflow: hidden;
  border: 1px solid rgba(199, 151, 54, 0.72);
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.1);
  flex: 0 0 auto;
}

.language-switcher button {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--gold);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.language-switcher button + button {
  border-left: 1px solid rgba(199, 151, 54, 0.5);
}

.language-switcher button:hover,
.language-switcher button:focus-visible {
  background: rgba(199, 151, 54, 0.2);
}

.language-switcher button.is-active,
.language-switcher button.is-active:hover,
.language-switcher button.is-active:focus-visible {
  background: var(--gold);
  color: var(--ink);
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid rgba(199, 151, 54, 0.65);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 248, 234, 0.12);
  color: var(--gold);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.header-link:hover,
.header-link:focus-visible {
  background: rgba(255, 248, 234, 0.2);
}

.header-link:focus-visible {
  outline: 3px solid rgba(199, 151, 54, 0.55);
  outline-offset: 2px;
}

.header-link > span[aria-hidden="true"] {
  font-family: "Courier New", monospace;
  line-height: 1;
}

.app-hub {
  display: grid;
  grid-template-columns: minmax(220px, 0.62fr) minmax(0, 1.38fr);
  gap: 18px;
  max-height: 34dvh;
  overflow: auto;
  padding: 16px 18px 18px;
  border-bottom: 1px solid rgba(140, 107, 63, 0.42);
  background:
    linear-gradient(90deg, rgba(246, 236, 216, 0.96), rgba(239, 226, 201, 0.9)),
    repeating-linear-gradient(0deg, rgba(140, 107, 63, 0.12) 0 1px, transparent 1px 34px);
}

.app-hub-home {
  min-height: calc(100dvh - 68px);
  max-height: none;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  overflow: auto;
  padding: 22px 28px 30px;
  background:
    repeating-linear-gradient(0deg, rgba(140, 107, 63, 0.1) 0 1px, transparent 1px 34px),
    linear-gradient(135deg, #fff8e9, #f4e7c6 56%, #edf4ef);
}

.app-hub-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
  min-width: 0;
}

.app-hub-home .app-hub-copy {
  align-content: center;
  max-width: none;
  min-height: 136px;
  border: 1px solid rgba(140, 107, 63, 0.28);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 252, 243, 0.86);
  box-shadow: 0 10px 30px rgba(36, 48, 68, 0.08);
}

.app-hub-home .app-hub-eyebrow,
.app-hub-home h2,
.app-hub-home .app-hub-copy p:last-child {
  color: var(--ink);
  text-shadow: none;
}

.app-hub-home h2 {
  max-width: 18ch;
  font-size: 1.9rem;
  line-height: 1.02;
}

.app-hub-home .app-hub-copy p:last-child {
  max-width: 52ch;
  color: rgba(36, 48, 68, 0.76);
  font-size: 0.96rem;
}

.app-hub-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.app-hub-shortcut {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 66px;
  padding: 10px;
  border: 1px solid rgba(140, 107, 63, 0.32);
  border-radius: 8px;
  background: rgba(255, 252, 243, 0.92);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(36, 48, 68, 0.08);
  overflow: hidden;
}

.app-hub-shortcut::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--gold);
}

.app-hub-shortcut:nth-child(3n + 2)::before {
  background: #6f9487;
}

.app-hub-shortcut:nth-child(3n)::before {
  background: #b45f4d;
}

.app-hub-shortcut-primary {
  background: var(--ink);
  color: #fff8e7;
}

.app-hub-shortcut-primary .app-hub-card-icon {
  background: var(--gold);
  color: var(--ink);
}

.app-hub-shortcut-primary .app-hub-card-text strong {
  color: #fff8e7;
}

.app-hub-shortcut:disabled {
  cursor: default;
  opacity: 1;
}

.app-hub-shortcut .app-hub-card-status {
  display: none;
}

.app-hub-gallery {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.app-hub-gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.app-hub-gallery-title-group {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.app-hub-new-canvas {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--gold);
  border-radius: 7px;
  background: var(--ink);
  color: #fff8e7;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(36, 48, 68, 0.13);
}

.app-hub-new-canvas:hover,
.app-hub-new-canvas:focus-visible {
  background: #34445e;
  color: #fff8e7;
}

.app-hub-new-canvas span:first-child {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
}

.app-hub-gallery-heading h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1.05;
}

.app-hub-gallery-heading p:last-child {
  max-width: 42ch;
  margin: 0;
  color: rgba(36, 48, 68, 0.68);
  font-size: 0.92rem;
  line-height: 1.35;
}

.gallery-sign-in-notice {
  margin-top: 32px;
  padding: 20px 0;
  border-top: 1px solid var(--ink);
}

.gallery-sign-in-notice a {
  color: var(--ink);
  font-weight: 700;
}

.gallery-sign-in-notice[hidden],
.app-hub-gallery-grid[hidden] {
  display: none;
}

.app-hub-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.app-hub-gallery-empty {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 16px;
  min-height: 190px;
  border: 1px dashed rgba(140, 107, 63, 0.54);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 252, 243, 0.56);
  color: var(--ink);
}

.app-hub-empty-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: rgba(199, 151, 54, 0.13);
  color: var(--gold);
  font-size: 2rem;
  line-height: 1;
}

.app-hub-gallery-empty strong {
  display: block;
  font-size: 1.15rem;
}

.app-hub-gallery-empty p {
  max-width: 48ch;
  margin: 6px 0 0;
  color: rgba(36, 48, 68, 0.7);
  line-height: 1.4;
}

.app-hub-spell-card {
  color: var(--ink);
  text-decoration: none;
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(140, 107, 63, 0.28);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 252, 243, 0.92);
  box-shadow: 0 12px 26px rgba(36, 48, 68, 0.09);
}

.app-hub-spell-card:hover,
.app-hub-spell-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.app-home-page [data-app-hub] {
  min-height: 0;
}

.app-hub-shortcut:disabled .app-hub-card-status {
  display: block;
  margin-top: 4px;
}

.app-hub-spell-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid rgba(140, 107, 63, 0.18);
  border-radius: 6px;
  background: #fff;
}

.app-hub-spell-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(140, 107, 63, 0.18);
  border-radius: 6px;
  background: #fff;
  color: var(--gold);
  font-size: 3rem;
}

.app-hub-spell-card strong {
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.12;
}

.app-hub-spell-card small {
  color: rgba(36, 48, 68, 0.66);
  font-size: 0.78rem;
  line-height: 1.2;
}

.app-hub-copy {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
}

.app-hub-eyebrow {
  margin: 0;
  color: #9d3d30;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-hub h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.35rem, 2.8vw, 2.5rem);
  line-height: 1;
}

.app-hub-copy p:last-child {
  max-width: 48ch;
  margin: 0;
  color: rgba(36, 48, 68, 0.78);
  font-size: 0.98rem;
  line-height: 1.45;
}

.app-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: center;
  gap: 12px;
  min-width: 0;
}

.app-hub-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 112px;
  padding: 14px;
  border: 1px solid rgba(140, 107, 63, 0.46);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 252, 243, 0.94), rgba(245, 232, 196, 0.86)),
    var(--button);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 16px 34px rgba(36, 48, 68, 0.13);
  overflow: hidden;
}

.app-hub-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--gold);
}

.app-hub-card:nth-child(3n + 2)::before {
  background: #6f9487;
}

.app-hub-card:nth-child(3n)::before {
  background: #b45f4d;
}

.app-hub-card-primary {
  grid-row: span 2;
  min-height: 236px;
  border-color: rgba(199, 151, 54, 0.8);
  background:
    linear-gradient(160deg, rgba(36, 48, 68, 0.96), rgba(66, 88, 79, 0.94)),
    var(--ink);
  color: #fff8e7;
}

.app-hub-card-primary::before {
  height: 6px;
  background: linear-gradient(90deg, var(--gold), #d9ebe2);
}

.app-hub-card-primary .app-hub-card-icon {
  width: 52px;
  height: 52px;
  background: var(--gold);
  color: var(--ink);
}

.app-hub-card-primary .app-hub-card-text strong {
  color: #fff8e7;
  font-size: 1.22rem;
}

.app-hub-card-primary .app-hub-card-text small {
  color: rgba(255, 248, 231, 0.78);
}

.app-hub-card-primary .app-hub-card-status {
  border-color: rgba(199, 151, 54, 0.58);
  background: rgba(255, 248, 231, 0.1);
  color: rgba(255, 248, 231, 0.78);
}

.app-hub-card:disabled {
  cursor: default;
  opacity: 1;
}

.app-hub-card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(199, 151, 54, 0.64);
  border-radius: 50%;
  background: rgba(36, 48, 68, 0.95);
  color: var(--gold);
  font-family: "Courier New", monospace;
  font-weight: 800;
  line-height: 1;
}

.app-hub-card-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.app-hub-card-text strong {
  font-size: 1rem;
  line-height: 1.1;
}

.app-hub-card-text small {
  color: rgba(36, 48, 68, 0.72);
  font-size: 0.82rem;
  line-height: 1.25;
}

.app-hub-card-status {
  grid-column: 1 / -1;
  align-self: end;
  width: fit-content;
  border: 1px solid rgba(140, 107, 63, 0.36);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(246, 236, 216, 0.9);
  color: rgba(36, 48, 68, 0.7);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.app-home-page .workspace {
  display: none;
}

.app-home-page .grimoire,
.app-home-page .simulator-ad-placement {
  display: none;
}

html[data-app-view="atelier"] body.app-home-page .app-shell {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

html[data-app-view="atelier"] body.app-home-page .app-hub {
  display: none;
}

html[data-app-view="atelier"] body.app-home-page .workspace {
  display: grid;
}

html[data-app-view="atelier"] body.app-home-page .grimoire {
  display: block;
}

.canvas-wrap {
  position: relative;
  min-height: 0;
  background: var(--paper);
  overflow: auto;
  overscroll-behavior: contain;
}

.atelier-badge {
  position: absolute;
  z-index: 3;
  top: 18px;
  left: 88px;
  border: 1px solid rgba(140, 107, 63, 0.48);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 248, 234, 0.86);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 8px 24px var(--shadow);
  backdrop-filter: blur(8px);
}

.floating-tools {
  position: absolute;
  z-index: 4;
  top: 16px;
  left: 50%;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  max-width: calc(100% - 28px);
  gap: 8px;
  overflow-x: auto;
  transform: translateX(-50%);
  border: 1px solid rgba(140, 107, 63, 0.58);
  border-radius: 18px;
  padding: 9px;
  background: rgba(255, 248, 234, 0.92);
  box-shadow: 0 16px 36px var(--shadow);
  backdrop-filter: blur(10px);
}

.simulator-page.toolbar-side .floating-tools {
  top: 12px;
  left: 18px;
  right: auto;
  display: grid;
  grid-template-columns: repeat(2, 42px);
  max-width: none;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  transform: none;
}

.simulator-page.toolbar-compact .floating-tools {
  display: flex;
  flex-direction: column;
  width: 60px;
  gap: 7px;
  transform: none;
  border-radius: 20px;
  padding: 8px;
  touch-action: none;
  transition: left 180ms ease, right 180ms ease, top 180ms ease, box-shadow 180ms ease;
}

.simulator-page.toolbar-compact:not(.toolbar-side) .floating-tools {
  flex-direction: row;
  width: auto;
  transform: translateX(-50%);
}

.simulator-page.toolbar-side.toolbar-compact .floating-tools {
  top: 50%;
  left: 18px;
  display: flex;
  flex-direction: column;
  width: 60px;
  max-width: none;
  transform: none;
}

.simulator-page.toolbar-compact .floating-tools.is-dragging {
  transition: none;
  box-shadow: 0 22px 44px rgba(36, 48, 68, 0.3);
}

.simulator-page.toolbar-compact .floating-tools .tool-button:not(.toolbar-keep) {
  display: none;
}

.tool-button.toolbar-keep {
  border-color: rgba(36, 48, 68, 0.62);
}

.simulator-page.toolbar-side.toolbar-compact #toolbarCompactButton {
  cursor: grab;
  touch-action: none;
}

.simulator-page.toolbar-side.toolbar-compact .floating-tools.is-dragging #toolbarCompactButton {
  cursor: grabbing;
}

.simulator-page.alignment-assist-on #magicCanvas {
  background-image:
    linear-gradient(rgba(199, 151, 54, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(199, 151, 54, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(36, 48, 68, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 48, 68, 0.2) 1px, transparent 1px);
  background-size:
    var(--grid-step) var(--grid-step),
    var(--grid-step) var(--grid-step),
    calc(var(--canvas-size) / 2) calc(var(--canvas-size) / 2),
    calc(var(--canvas-size) / 2) calc(var(--canvas-size) / 2);
}

.selection-rotation-dock {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  gap: 6px;
  transform: translate(-50%, -100%);
  border: 1px solid rgba(140, 107, 63, 0.52);
  border-radius: 999px;
  padding: 5px;
  background: rgba(255, 248, 234, 0.94);
  box-shadow: 0 10px 24px var(--shadow);
  backdrop-filter: blur(8px);
}

.selection-rotation-dock[hidden] {
  display: none;
}

.selection-rotation-dock button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.selection-rotation-value {
  min-width: 48px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(35, 52, 82, 0.22);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
}

.view3d-panel {
  position: fixed;
  z-index: 120;
  inset: 0;
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #201a16;
  box-shadow: none;
}

.view3d-panel[hidden] {
  display: none;
}

.view3d-header {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(199, 151, 54, 0.4);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(32, 26, 22, 0.72);
  color: var(--gold);
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.view3d-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.view3d-workshop-tools {
  position: absolute;
  z-index: 3;
  top: 70px;
  left: 16px;
  display: flex;
  max-width: calc(100% - 32px);
  gap: 7px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid rgba(199, 151, 54, 0.38);
  border-radius: 16px;
  background: rgba(32, 26, 22, 0.78);
  box-shadow: 0 12px 32px rgba(22, 17, 14, 0.18);
  scrollbar-width: none;
  backdrop-filter: blur(10px);
}

.view3d-workshop-tools::-webkit-scrollbar {
  display: none;
}

.view3d-workshop-tools button {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 12px;
  border-color: rgba(199, 151, 54, 0.58);
  border-radius: 11px;
  background: rgba(246, 236, 216, 0.92);
  color: var(--ink);
  font-size: 0.82rem;
}

.view3d-workshop-tools button[aria-pressed="true"] {
  background: var(--gold);
  color: #172238;
}

.view3d-inspector,
.view3d-experiments {
  position: absolute;
  z-index: 3;
  right: 16px;
  width: min(270px, calc(100% - 32px));
  border: 1px solid rgba(199, 151, 54, 0.44);
  border-radius: 16px;
  padding: 11px 13px;
  background: rgba(32, 26, 22, 0.82);
  color: #f6ecd8;
  box-shadow: 0 14px 34px rgba(18, 14, 12, 0.2);
  backdrop-filter: blur(10px);
}

.view3d-inspector {
  top: 70px;
  display: grid;
  gap: 3px;
}

.view3d-inspector[hidden] {
  display: none;
}

.view3d-inspector span {
  color: #d1bd92;
  font-size: 0.86rem;
}

.view3d-experiments {
  right: 16px;
  bottom: 16px;
}

.view3d-experiments ol {
  display: grid;
  gap: 4px;
  margin: 7px 0 0;
  padding-left: 20px;
  color: #d1bd92;
  font-size: 0.78rem;
}

.view3d-experiments li.is-complete {
  color: #a6db9d;
  text-decoration: line-through;
}

.view3d-header button {
  display: grid;
  place-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  white-space: nowrap;
}

#close3dButton {
  width: 30px;
  padding: 0;
  border-radius: 50%;
}

#spell3dCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#spell3dCanvas:active {
  cursor: grabbing;
}

@media (max-width: 760px) {
  .view3d-header {
    top: 8px;
    left: 8px;
    right: 8px;
  }

  .view3d-workshop-tools {
    top: 58px;
    left: 8px;
    max-width: calc(100% - 16px);
  }

  .view3d-inspector {
    top: 108px;
    right: 8px;
    width: auto;
    max-width: calc(100% - 16px);
  }

  .view3d-experiments {
    right: 8px;
    bottom: 8px;
    width: min(230px, calc(100% - 16px));
    padding: 8px 10px;
  }
}

.tool-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 13px;
  font-weight: 700;
}

.tool-button span {
  display: block;
  color: var(--ink);
  font-family: "Courier New", monospace;
  font-size: 1.18rem;
  line-height: 1;
}

.tool-button.is-active {
  background: var(--button-active);
  box-shadow: 0 0 0 2px rgba(199, 151, 54, 0.52) inset;
}

.tool-button.selection-tool {
  border-color: rgba(199, 151, 54, 0.82);
}

.tool-button:disabled {
  cursor: default;
  opacity: 0.38;
}

#magicCanvas {
  display: block;
  width: var(--canvas-size);
  height: var(--canvas-size);
  min-width: 100%;
  min-height: 100%;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#magicCanvas.is-select-tool {
  cursor: default;
}

.selection-context-menu {
  position: fixed;
  z-index: 40;
  width: max-content;
  min-width: 176px;
  max-width: min(240px, calc(100vw - 20px));
  padding: 7px;
  border: 1px solid rgba(140, 107, 63, 0.78);
  border-radius: 14px;
  background: rgba(255, 249, 235, 0.98);
  box-shadow: 0 14px 34px rgba(43, 35, 23, 0.22);
  backdrop-filter: blur(8px);
}

.selection-context-menu[hidden] {
  display: none;
}

.selection-context-menu button {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 7px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font: 700 0.92rem Georgia, "Times New Roman", serif;
  text-align: left;
}

.selection-context-menu button:hover,
.selection-context-menu button:focus-visible {
  background: rgba(199, 151, 54, 0.18);
  outline: none;
}

.selection-context-menu button.is-danger {
  color: #8f352b;
}

.symbol-island,
.composition-island,
.details-island,
.support-island,
.guide-island,
.gallery-island {
  position: absolute;
  z-index: 7;
  right: 18px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border-radius: 999px;
  padding: 9px 15px;
  background: rgba(255, 248, 234, 0.92);
  font-weight: 700;
  box-shadow: 0 16px 36px var(--shadow);
  backdrop-filter: blur(10px);
}

.symbol-island {
  top: 18px;
}

.composition-island {
  top: 72px;
}

.details-island {
  top: 126px;
}

.support-island {
  top: 180px;
}

.guide-island {
  top: 234px;
}

.gallery-island {
  top: 288px;
}

.symbol-island > span[aria-hidden="true"],
.composition-island > span[aria-hidden="true"],
.details-island > span[aria-hidden="true"],
.support-island > span[aria-hidden="true"],
.guide-island > span[aria-hidden="true"],
.gallery-island > span[aria-hidden="true"] {
  color: var(--gold);
  font-family: "Courier New", monospace;
  font-size: 1.1rem;
  line-height: 1;
}

.sidebar {
  position: absolute;
  z-index: 12;
  top: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(430px, calc(100% - 24px));
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(140, 107, 63, 0.62);
  border-radius: 14px;
  background: var(--side);
  box-shadow: 0 22px 54px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 28px));
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.details-drawer {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.support-drawer {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.guide-drawer {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.gallery-drawer {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.simulator-page.details-open .details-drawer {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.simulator-page.symbols-open .symbol-drawer {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.simulator-page.support-open .support-drawer {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.simulator-page.guides-open .guide-drawer {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.simulator-page.gallery-open .gallery-drawer {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.simulator-page.symbols-open .details-drawer,
.simulator-page.symbols-open .support-drawer,
.simulator-page.details-open .symbol-drawer,
.simulator-page.details-open .support-drawer,
.simulator-page.support-open .symbol-drawer,
.simulator-page.support-open .details-drawer {
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 28px));
}

.simulator-page.symbols-open .gallery-drawer,
.simulator-page.details-open .gallery-drawer,
.simulator-page.support-open .gallery-drawer,
.simulator-page.guides-open .gallery-drawer,
.simulator-page.gallery-open .symbol-drawer,
.simulator-page.gallery-open .details-drawer,
.simulator-page.gallery-open .support-drawer,
.simulator-page.gallery-open .guide-drawer {
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 28px));
}

.simulator-page.symbols-open .symbol-island,
.simulator-page.composition-open .composition-island,
.simulator-page.details-open .details-island,
.simulator-page.support-open .support-island,
.simulator-page.guides-open .guide-island,
.simulator-page.gallery-open .gallery-island {
  opacity: 0;
  pointer-events: none;
}

.guide-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border: 1px solid rgba(140, 107, 63, 0.35);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 248, 234, 0.58);
}

.guide-controls .compact-check,
.guide-controls .guide-opacity-field {
  grid-column: auto;
  min-height: 42px;
}

.guide-controls #clearGuideButton {
  grid-column: 1 / -1;
}

.guide-transform-controls {
  display: grid;
  grid-template-columns: auto repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 6px;
  grid-column: 1 / -1;
}

.guide-transform-controls button {
  min-width: 0;
  min-height: 34px;
  padding: 5px 7px;
  overflow-wrap: anywhere;
}

.guide-transform-readout {
  min-width: 42px;
  color: var(--edge);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
}

.guide-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.guide-tabs button {
  min-width: 0;
  padding: 8px;
  border-radius: 999px;
  font-weight: 700;
}

.guide-tabs button.is-active {
  background: var(--button-active);
  box-shadow: 0 0 0 2px rgba(199, 151, 54, 0.44) inset;
}

.guide-library-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(120px, 0.9fr);
  gap: 7px;
}

.guide-library-search,
.guide-library-category {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--edge);
  font-size: 0.68rem;
  font-weight: 700;
}

.guide-library-search input,
.guide-library-category select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid rgba(140, 107, 63, 0.45);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.9);
  color: var(--ink);
  font: inherit;
}

.guide-library-status {
  margin: 0;
  color: var(--edge);
  font-size: 0.72rem;
}

.guide-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 9px;
  min-height: 96px;
  padding: 2px 4px 2px 2px;
}

.guide-list[hidden] {
  display: none;
}

.guide-card {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(140, 107, 63, 0.46);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 248, 234, 0.86);
  text-align: left;
}

.guide-card.is-active {
  border-color: var(--gold);
  background: #f4e3bd;
  box-shadow: 0 0 0 2px rgba(199, 151, 54, 0.38);
}

.guide-card img,
.guide-card-preview {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(140, 107, 63, 0.24);
  border-radius: 8px;
  background: #fffaf0;
  object-fit: contain;
}

.guide-card-preview {
  display: grid;
  place-items: center;
  color: var(--edge);
  font-size: 2rem;
}

.guide-card-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-card-effect {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  color: rgba(82, 65, 44, 0.78);
  font-size: 0.68rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.guide-card-meta {
  margin: 0;
  color: var(--edge);
  font-size: 0.72rem;
}

.guide-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 6px;
  min-width: 0;
}

.guide-card-actions button {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  padding: 5px 8px;
  overflow-wrap: anywhere;
}

.guide-card-actions-single {
  grid-template-columns: minmax(0, 1fr);
}

.guide-card-missing {
  color: var(--edge);
}

.guide-card > button:first-child {
  display: grid;
  gap: 7px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.guide-empty {
  grid-column: 1 / -1;
  margin: 12px 4px;
  color: var(--edge);
  line-height: 1.4;
}

.gallery-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.gallery-actions > a,
.gallery-actions > button {
  display: block;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.74);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.gallery-actions > button {
  background: var(--button-active);
  cursor: pointer;
}

.gallery-actions > a:hover,
.gallery-actions > button:hover {
  filter: brightness(0.97);
}

.gallery-note {
  margin: 0;
  color: var(--edge);
  line-height: 1.45;
}

.gallery-feed-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  margin: 14px 0 10px;
}

.gallery-feed-toolbar button {
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--edge) 65%, transparent);
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.74);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.gallery-feed-toolbar button.is-active {
  border-color: var(--gold);
  background: var(--button-active);
}

.gallery-feed {
  display: grid;
  gap: 12px;
  min-height: 96px;
  margin-bottom: 12px;
}

.gallery-feed-message {
  margin: 0;
  padding: 24px 14px;
  border: 1px dashed color-mix(in srgb, var(--edge) 48%, transparent);
  border-radius: 12px;
  color: var(--edge);
  line-height: 1.45;
  text-align: center;
}

.gallery-feed-card {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--edge) 52%, transparent);
  border-radius: 14px;
  background: rgba(255, 250, 239, 0.9);
  box-shadow: 0 8px 20px rgba(56, 39, 19, 0.08);
}

.gallery-feed-preview {
  display: grid;
  min-height: 148px;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 34%, transparent);
  background:
    radial-gradient(circle, transparent 35%, rgba(197, 146, 42, 0.15) 36% 37%, transparent 38%),
    rgba(247, 237, 211, 0.78);
}

.gallery-feed-preview img {
  width: 100%;
  height: 176px;
  object-fit: cover;
}

.gallery-feed-preview.is-generated span {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border: 3px double var(--gold);
  border-radius: 50%;
  color: var(--ink);
  font-size: 2rem;
}

.gallery-feed-preview.is-empty span {
  color: var(--edge);
  font-style: italic;
}

.gallery-feed-copy {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.gallery-feed-copy p,
.gallery-feed-copy h3 {
  margin: 0;
}

.gallery-feed-copy h3 {
  font-size: 1.12rem;
  line-height: 1.15;
}

.gallery-feed-copy h3 a,
.gallery-feed-stats a {
  color: var(--ink);
}

.gallery-feed-kicker,
.gallery-feed-author {
  color: var(--edge);
  font-size: 0.78rem;
}

.gallery-feed-body {
  display: -webkit-box;
  overflow: hidden;
  color: color-mix(in srgb, var(--ink) 82%, transparent);
  font-size: 0.9rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.gallery-feed-tags,
.gallery-feed-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-feed-tags li {
  padding: 2px 7px;
  border: 1px solid rgba(151, 115, 66, 0.34);
  border-radius: 999px;
  color: var(--edge);
  font-size: 0.72rem;
}

.gallery-feed-stats {
  padding-top: 6px;
  border-top: 1px solid rgba(151, 115, 66, 0.22);
  color: var(--edge);
  font-size: 0.72rem;
}

.gallery-feed-stats a {
  margin-left: auto;
  font-weight: 700;
}

@media (max-width: 430px) {
  .gallery-actions,
  .gallery-feed-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 621px) {
  .simulator-page.symbols-open .details-island,
  .simulator-page.symbols-open .support-island,
  .simulator-page.details-open .symbol-island,
  .simulator-page.details-open .support-island,
  .simulator-page.support-open .symbol-island,
  .simulator-page.support-open .details-island,
  .simulator-page.symbols-open .guide-island,
  .simulator-page.details-open .guide-island,
  .simulator-page.support-open .guide-island,
  .simulator-page.guides-open .symbol-island,
  .simulator-page.guides-open .details-island,
  .simulator-page.guides-open .support-island,
  .simulator-page.gallery-open .symbol-island,
  .simulator-page.gallery-open .details-island,
  .simulator-page.gallery-open .support-island,
  .simulator-page.gallery-open .guide-island {
    z-index: 13;
    right: calc(min(430px, calc(100% - 24px)) + 24px);
  }
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
}

.panel-heading h2,
.settings h2,
.ink-readout h3 {
  margin: 0;
  line-height: 1.1;
}

.panel-heading h2,
.settings h2 {
  font-size: 1.15rem;
}

.panel-heading p,
.ink-readout p {
  margin: 5px 0 0;
  color: var(--edge);
  line-height: 1.35;
}

.ink-list {
  display: grid;
  flex: 1 1 auto;
  gap: 7px;
  min-height: 96px;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.ink-list[hidden] {
  display: none !important;
}

.symbol-drawer-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 2px 0 8px;
  border-bottom: 1px solid rgba(140, 107, 63, 0.45);
}

.symbol-drawer-tabs button {
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid rgba(140, 107, 63, 0.42);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(159, 133, 88, 0.18);
  color: var(--edge);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.symbol-drawer-tabs button.is-active {
  background: rgba(199, 151, 54, 0.24);
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sigil-composition-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(260px, 1fr) auto;
  flex: 1 1 auto;
  gap: 9px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sigil-composition-panel[hidden] {
  display: none !important;
}

.composition-meta {
  display: grid;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid rgba(140, 107, 63, 0.42);
  border-radius: 7px;
  background: rgba(255, 248, 234, 0.58);
}

.composition-editor-shell {
  display: grid;
  grid-template-columns: minmax(150px, 0.72fr) minmax(220px, 1.28fr);
  gap: 8px;
  min-height: 360px;
  align-items: start;
}

.composition-seal-browser,
.composition-inspector {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  max-height: 360px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(140, 107, 63, 0.42);
  border-radius: 7px;
  background: rgba(255, 248, 234, 0.58);
}

.composition-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.composition-editor-heading h3 {
  margin: 0;
  color: var(--edge);
  font-size: 0.7rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.composition-editor-heading button,
.composition-editor-actions button,
.composition-tree-add,
.composition-remove-item {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid rgba(140, 107, 63, 0.52);
  border-radius: 6px;
  background: rgba(255, 248, 234, 0.94);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
}

.composition-seal-list {
  display: grid;
  gap: 3px;
  max-height: 230px;
  overflow: auto;
  padding-right: 2px;
}

.composition-tree-item,
.composition-tree-add {
  width: 100%;
  min-height: 28px;
  text-align: left;
}

.composition-tree-item {
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composition-tree-item.is-active {
  border-color: var(--gold);
  background: rgba(199, 151, 54, 0.15);
}

.composition-tree-child {
  padding-left: 14px;
  font-weight: 600;
}

.composition-tree-heading {
  padding: 3px 5px 1px;
  color: var(--edge);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.composition-tree-add {
  min-height: 24px;
  padding: 3px 7px;
  color: var(--edge);
  font-size: 0.67rem;
}

.composition-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.composition-selection-label {
  color: var(--edge);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.composition-inspector-content {
  display: grid;
  gap: 5px;
  max-height: 280px;
  overflow: auto;
  padding-right: 2px;
}

.composition-inspector-field,
.composition-texture-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(74px, 1.25fr);
  align-items: center;
  gap: 6px;
  color: var(--edge);
  font-size: 0.68rem;
  font-weight: 700;
}

.composition-inspector-field input,
.composition-inspector-field select,
.composition-texture-field select {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 4px 5px;
  border: 1px solid rgba(140, 107, 63, 0.45);
  border-radius: 5px;
  background: rgba(255, 252, 243, 0.92);
  color: var(--ink);
  font: inherit;
}

.composition-inspector-check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
}

.composition-remove-item {
  color: #8b3b32;
}

.composition-texture-field {
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.composition-draft-mode {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
}

.composition-size-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  color: var(--edge);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.composition-size-control output {
  color: var(--ink);
  font-size: 0.82rem;
  text-transform: none;
}

.composition-size-control input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--gold);
}

.composition-add-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.composition-add-bar button {
  min-height: 38px;
  border: 1px solid rgba(140, 107, 63, 0.58);
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.94);
  color: var(--ink);
  font-weight: 700;
}

.composition-add-bar button:hover,
.composition-add-bar button:focus-visible {
  border-color: var(--gold);
  background: rgba(199, 151, 54, 0.16);
}

.composition-symbol-picker {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(140, 107, 63, 0.5);
  border-radius: 9px;
  background: rgba(255, 248, 234, 0.96);
  box-shadow: 0 10px 24px rgba(76, 55, 30, 0.13);
}

.composition-symbol-picker[hidden],
.composition-symbol-picker [hidden] {
  display: none !important;
}

.composition-symbol-picker .composition-editor-heading button {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
}

.composition-symbol-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--edge);
  font-size: 0.7rem;
  font-weight: 700;
}

.composition-symbol-search input {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(140, 107, 63, 0.45);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}

.composition-tool-tray {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.composition-tool-group {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.composition-tool-group h3 {
  margin: 0;
  color: var(--edge);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.composition-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 4px;
  max-height: 82px;
  overflow: auto;
  padding-right: 2px;
}

.composition-symbol-picker .composition-chip-grid {
  max-height: 190px;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
}

.composition-range-field {
  display: grid;
  gap: 5px;
  padding: 7px 8px;
  border: 1px solid rgba(140, 107, 63, 0.28);
  border-radius: 7px;
  background: rgba(255, 252, 243, 0.66);
}

.composition-range-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--edge);
  font-size: 0.69rem;
  font-weight: 700;
}

.composition-range-heading output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.composition-range-field input {
  width: 100%;
  accent-color: var(--gold);
}

.composition-orientation-joystick {
  padding-bottom: 10px;
  background: linear-gradient(90deg, rgba(36, 48, 68, 0.06), rgba(199, 151, 54, 0.16), rgba(36, 48, 68, 0.06));
}

.composition-orientation-joystick input {
  height: 26px;
  cursor: ew-resize;
}

.composition-orientation-joystick input::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
}

.composition-chip {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 34px;
  padding: 4px;
  border: 1px solid rgba(140, 107, 63, 0.5);
  border-radius: 6px;
  background: rgba(255, 248, 234, 0.9);
  color: var(--symbol-color, var(--ink));
}

.composition-chip.is-active,
.composition-chip:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(199, 151, 54, 0.24);
}

.composition-stage {
  position: relative;
  min-height: 300px;
  padding: 12px;
  border: 1px solid rgba(140, 107, 63, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 248, 234, 0.76), rgba(244, 228, 191, 0.58)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(140, 107, 63, 0.12) 32px);
  text-align: center;
}

.composition-preview-title {
  position: absolute;
  left: 12px;
  top: 10px;
  color: var(--edge);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.composition-preview-seal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(210px, var(--composition-circle-size, 68%));
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid var(--edge);
  border-radius: 50%;
}

.composition-document-seal {
  position: absolute;
  aspect-ratio: 1;
  transform-origin: center;
  cursor: pointer;
}

.composition-document-outline,
.composition-document-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: auto;
}

.composition-document-outline {
  width: 100%;
  border: 1px solid rgba(140, 107, 63, 0.52);
  transform: translate(-50%, -50%);
}

.composition-document-ring {
  background: transparent;
  cursor: pointer;
}

.composition-document-ring.is-active {
  box-shadow: 0 0 0 3px rgba(199, 151, 54, 0.2);
}

.composition-document-element {
  z-index: 2;
  width: 48px;
  min-width: 48px;
  border-style: solid;
  background: rgba(255, 248, 234, 0.93);
}

.composition-document-element[data-slot-kind="sigil"],
.composition-document-element.is-sigil {
  width: 58px;
  min-width: 58px;
}

.composition-slot {
  position: absolute;
  display: grid;
  place-items: center;
  width: 58px;
  min-width: 58px;
  aspect-ratio: 1;
  padding: 5px;
  border: 1px dashed rgba(140, 107, 63, 0.66);
  border-radius: 50%;
  background: rgba(255, 248, 234, 0.8);
  color: var(--symbol-color, var(--edge));
  transform: translate(-50%, -50%);
}

.composition-slot.is-active {
  border-style: solid;
  border-color: var(--gold);
  background: rgba(255, 248, 234, 0.96);
  box-shadow: 0 0 0 3px rgba(199, 151, 54, 0.2);
}

.composition-slot[data-slot-kind="sigil"] {
  width: 70px;
  min-width: 70px;
}

.composition-slot-empty {
  color: var(--edge);
  font-size: 0.72rem;
  font-weight: 700;
}

.composition-stage .symbol-mark {
  width: 100%;
  height: 100%;
}

.composition-stage .composition-document-element {
  box-sizing: border-box;
  padding: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.composition-document-element .symbol-board-glyph {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.composition-action-row {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 8px;
}

.composition-clear,
.composition-cancel,
.composition-apply {
  width: 100%;
  min-height: 40px;
  border-radius: 7px;
  font-weight: 700;
}

.symbol-section {
  display: grid;
  gap: 7px;
}

.symbol-section + .symbol-section {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.symbol-section-title {
  margin: 0;
  color: var(--edge);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ink-button {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 68px;
  padding: 8px 10px;
  border-color: rgba(140, 107, 63, 0.54);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(199, 151, 54, 0.14), transparent 34%),
    rgba(255, 248, 234, 0.9);
  cursor: grab;
  text-align: left;
  touch-action: pan-y;
  font-weight: 700;
}

.ink-button.is-active {
  background: var(--button-active);
}

.ink-button:active {
  cursor: grabbing;
}

.ink-button .symbol-icon {
  width: 48px;
  height: 48px;
  border-color: rgba(140, 107, 63, 0.72);
  border-radius: 8px;
}

.ink-button::after {
  content: "||";
  color: rgba(140, 107, 63, 0.72);
  font: 700 0.78rem "Courier New", monospace;
  letter-spacing: -4px;
}

.symbol-drag-ghost {
  position: fixed;
  z-index: 40;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 2px solid var(--gold);
  border-radius: 14px;
  background: rgba(255, 248, 234, 0.96);
  box-shadow:
    0 14px 30px rgba(36, 48, 68, 0.24),
    0 0 0 4px rgba(199, 151, 54, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.86) rotate(-3deg);
  transition:
    opacity 120ms ease,
    transform 120ms ease,
    border-color 120ms ease;
}

.symbol-drag-ghost .symbol-icon {
  width: 50px;
  height: 50px;
  border: 0;
  background: transparent;
}

.simulator-page.is-dragging-symbol .symbol-drag-ghost {
  opacity: 0.94;
  transform: translate(-50%, -50%) scale(1) rotate(-3deg);
}

.simulator-page.is-dragging-symbol.is-valid-drop .symbol-drag-ghost {
  border-color: #5c8b62;
  box-shadow:
    0 14px 30px rgba(36, 48, 68, 0.24),
    0 0 0 5px rgba(92, 139, 98, 0.2);
}

@media (min-width: 1181px) {
  .simulator-page.symbols-open .symbol-drawer {
    position: fixed;
    z-index: 50;
    top: 84px;
    right: 12px;
    bottom: 12px;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .symbol-drag-ghost {
    transition: none;
  }
}

.support-list {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 10px;
  min-height: 96px;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.support-button {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  width: 100%;
  min-height: 112px;
  padding: 10px 12px;
  text-align: left;
}

.support-button.is-active {
  background: var(--button-active);
  box-shadow: 0 0 0 2px rgba(199, 151, 54, 0.42) inset;
}

.support-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.support-visual {
  display: block;
  width: 74px;
  height: 74px;
}

.support-illustration {
  display: block;
  width: 74px;
  height: 74px;
}

.support-illustration-raster {
  object-fit: contain;
  filter: drop-shadow(0 4px 4px rgba(71, 50, 25, 0.18));
}

.support-illustration rect {
  fill: rgba(255, 250, 239, 0.82);
  stroke: rgba(140, 107, 63, 0.38);
  stroke-width: 1.4;
}

.support-illustration path,
.support-illustration circle,
.support-illustration ellipse,
.support-illustration line,
.support-illustration polyline,
.support-illustration polygon {
  fill: none;
  stroke: #243044;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.support-illustration .support-fill {
  fill: rgba(234, 216, 184, 0.78);
  stroke: #243044;
}

.support-illustration .support-paper {
  fill: rgba(255, 248, 234, 0.96);
  stroke: #8c6b3f;
  stroke-width: 2.4;
}

.support-illustration .support-detail {
  fill: none;
  stroke: #243044;
  stroke-width: 2.2;
}

.support-illustration .support-accent {
  fill: none;
  stroke: #c79736;
  stroke-width: 2.3;
}

.support-illustration .support-shadow {
  fill: none;
  stroke: rgba(140, 107, 63, 0.54);
  stroke-width: 2.1;
}

.support-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.support-title {
  display: block;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.08;
}

.support-meta {
  display: grid;
  gap: 4px;
  margin-top: 3px;
  color: var(--edge);
  font-size: 0.93rem;
  line-height: 1.24;
}

.support-meta span {
  display: list-item;
  margin-left: 1.1em;
}

.swatch {
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink);
}

.symbol-icon {
  display: grid;
  place-items: center;
  justify-items: center;
  align-items: center;
  box-sizing: border-box;
  width: 42px;
  height: 42px;
  border: 1px solid var(--ink);
  color: var(--symbol-color);
  background: rgba(255, 248, 234, 0.72);
  overflow: hidden;
}

.symbol-mark {
  display: block;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0;
  overflow: hidden;
}

.symbol-board-glyph {
  display: block;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0;
  background: currentColor;
  -webkit-mask-image: var(--symbol-mask);
  mask-image: var(--symbol-mask);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.symbol-mark path,
.symbol-mark circle,
.symbol-mark ellipse {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ink-button[data-symbol="Fumee"] .symbol-mark path {
  stroke-width: 2.25;
}

.symbol-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.symbol-name {
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.symbol-copy small {
  color: var(--edge);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.symbol-rune {
  font: 700 0.62rem "Courier New", monospace;
}

.normal-ink {
  display: inline-block;
  margin-right: 7px;
  vertical-align: -3px;
  background: #201a16;
}

.ink-readout {
  border-top: 1px solid rgba(140, 107, 63, 0.35);
  padding-top: 12px;
}

.ink-readout h3 {
  font-size: 1rem;
}

#usedList {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  max-height: 136px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#usedList li {
  border: 1px solid rgba(140, 107, 63, 0.35);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--button);
  font-size: 0.86rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.ink-readout p,
.state-grid strong {
  overflow-wrap: anywhere;
}

.state-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  margin-top: 8px;
}

.state-grid span {
  color: var(--edge);
}

.state-grid strong {
  justify-self: end;
}

.state-grid strong.is-danger {
  color: #9a2c2c;
}

.grimoire {
  display: block;
  padding: 12px 16px 14px;
  background:
    linear-gradient(180deg, rgba(255, 250, 239, 0.72), rgba(234, 216, 184, 0.54)),
    var(--paper);
  border-top: 3px solid var(--edge);
}

.grimoire-content {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.grimoire-toggle {
  display: none;
}

.settings {
  grid-column: 1 / span 7;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(140, 107, 63, 0.26);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 248, 234, 0.58);
}

.settings h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.setting-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.range-field,
.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 700;
}

.range-field {
  grid-column: span 2;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid rgba(151, 109, 61, 0.24);
  border-radius: 8px;
  background: rgba(255, 250, 239, 0.52);
}

.range-field span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  line-height: 1.1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.range-field input:not([type="hidden"]) {
  width: 100%;
  accent-color: var(--gold);
}

.range-field strong {
  color: var(--edge);
  font-size: 0.9em;
  white-space: nowrap;
}

.check-field input {
  flex: 0 0 auto;
  accent-color: var(--edge);
}

.check-field {
  grid-column: span 2;
  align-items: flex-start;
  min-height: 58px;
  border: 1px solid rgba(151, 109, 61, 0.18);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 250, 239, 0.36);
  font-size: 0.9rem;
  line-height: 1.2;
}

.check-field span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.scale-field {
  justify-content: space-between;
}

.color-field input[type="color"] {
  min-height: 42px;
  border: 1px solid rgba(140, 107, 63, 0.42);
  border-radius: 8px;
  padding: 4px;
  background: rgba(255, 248, 234, 0.8);
  cursor: pointer;
}

.color-field input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}

.scale-field input[type="range"] {
  min-height: 32px;
}

.zoom-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(42px, 1fr));
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(140, 107, 63, 0.36);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.8);
}

.zoom-control button {
  display: grid;
  place-items: center;
  min-height: 42px;
  min-width: 0;
  border: 0;
  border-left: 1px solid rgba(140, 107, 63, 0.28);
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.zoom-control button:first-child {
  border-left: 0;
}

.zoom-control button:hover,
.zoom-control button:focus-visible {
  background: rgba(234, 216, 184, 0.68);
}

.zoom-control button:disabled {
  cursor: default;
  opacity: 0.42;
}

.zoom-control span {
  display: block;
  color: var(--ink);
  font-family: "Courier New", monospace;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.commands {
  display: grid;
  grid-column: 8 / -1;
  align-self: start;
  min-width: 0;
  gap: 9px;
  border: 1px solid rgba(140, 107, 63, 0.26);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 248, 234, 0.48);
  overflow: hidden;
}

.commands h2 {
  margin: 0;
  font-size: 1rem;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.commands button {
  white-space: normal;
  overflow-wrap: anywhere;
}

.commands .command-button {
  min-height: 64px;
  padding: 9px 7px;
  font-weight: 700;
  min-width: 0;
  font-size: clamp(0.78rem, 0.9vw, 0.96rem);
  line-height: 1.08;
  box-shadow: none;
}

.command-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.command-primary:hover,
.command-primary:focus-visible {
  background: #34445e;
}

.command-community {
  border-color: var(--gold);
  background: var(--gold);
  color: #1f2d43;
}

.command-danger {
  color: #8b3535;
  border-color: rgba(139, 53, 53, 0.46);
}

.command-tool {
  background: rgba(127, 154, 134, 0.16);
  border-color: rgba(75, 111, 88, 0.46);
}

.command-archive {
  background: rgba(199, 151, 54, 0.08);
}

.status {
  grid-column: 1 / -1;
  display: grid;
  align-content: center;
  min-height: 72px;
  border: 1px solid rgba(140, 107, 63, 0.26);
  border-left: 3px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 248, 234, 0.54);
  color: var(--ink);
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.status.has-list {
  align-content: start;
  max-height: 154px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.status-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.status-list li {
  position: relative;
  padding-left: 16px;
}

.status-list li::before {
  position: absolute;
  left: 0;
  content: "-";
  color: var(--edge);
}

.settings-page {
  grid-template-rows: auto minmax(0, 1fr);
}

.settings-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(209, 189, 146, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(209, 189, 146, 0.16) 1px, transparent 1px),
    var(--paper);
  background-size: var(--grid-step) var(--grid-step);
}

.tutorial-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(209, 189, 146, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(209, 189, 146, 0.16) 1px, transparent 1px),
    var(--paper);
  background-size: var(--grid-step) var(--grid-step);
}

.library-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(209, 189, 146, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(209, 189, 146, 0.16) 1px, transparent 1px),
    var(--paper);
  background-size: var(--grid-step) var(--grid-step);
}

.reference-library-board {
  grid-template-columns: 1fr;
}

.circle-library-board {
  grid-template-columns: 1fr;
  align-items: start;
}

.wiki-layout {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(0, 1fr);
  align-items: start;
  background: var(--paper);
}

.wiki-toc {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 4px;
  margin: 18px 0 18px 18px;
  border-left: 3px solid var(--gold);
  padding: 10px 12px;
}

.wiki-toc strong {
  margin-bottom: 4px;
  color: var(--ink);
}

.wiki-toc a {
  padding: 5px 0;
  color: var(--edge);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.wiki-toc a:hover,
.wiki-toc a:focus-visible {
  color: var(--gold-dark);
  text-decoration: underline;
}

.wiki-content {
  min-width: 0;
}

.how-board {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.how-intro,
.how-card {
  border: 1px solid rgba(140, 107, 63, 0.34);
  border-radius: 10px;
  padding: 20px;
  background: rgba(255, 252, 237, 0.7);
  box-shadow: 0 8px 18px rgba(60, 43, 25, 0.08);
}

.how-intro {
  border-left: 5px solid var(--gold-dark);
}

.how-intro h2,
.how-card h2,
.how-card h3,
.how-card p {
  margin-top: 0;
}

.how-card p:last-child {
  margin-bottom: 0;
}

.how-output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.how-output {
  padding: 16px;
  border-radius: 8px;
  background: rgba(209, 189, 146, 0.2);
}

.how-output-mark {
  display: block;
  margin-bottom: 8px;
  color: var(--gold-dark);
  font-size: 1.7rem;
  line-height: 1;
}

.how-limits {
  border-color: rgba(139, 67, 43, 0.45);
}

.tutorial-wiki-layout .tutorial-board {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wiki-inline-link {
  color: var(--gold-dark);
  font-weight: 800;
}

.variant-explorer {
  display: grid;
  gap: 16px;
  min-width: 0;
  border-block: 2px solid rgba(140, 107, 63, 0.34);
  padding: 22px 0;
}

.wiki-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.wiki-section-heading h2,
.wiki-section-heading p,
.wiki-reference-section h2,
.wiki-reference-section p {
  margin: 0;
}

.wiki-kicker {
  color: var(--gold-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.variant-count {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 800;
}

.variant-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
}

.variant-filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.variant-filters .variant-search {
  grid-column: span 2;
}

.variant-filters input,
.variant-filters select,
.variant-filters button {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(140, 107, 63, 0.55);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fffaf0;
  color: var(--ink);
  font: 700 0.9rem/1.2 var(--font-ui);
}

.variant-filters button,
.variant-pager button,
.variant-result button {
  cursor: pointer;
}

.variant-notice {
  margin: 0;
  color: var(--gold-dark);
  font-weight: 700;
}

.variant-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.variant-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  align-items: center;
  min-width: 0;
  border: 1px solid rgba(140, 107, 63, 0.38);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 250, 240, 0.82);
}

.daily-spell-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 14px;
  align-items: center;
  min-width: 0;
  margin: 0 0 14px;
  border: 1px solid rgba(140, 107, 63, 0.55);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: linear-gradient(120deg, rgba(255, 244, 214, 0.92), rgba(255, 250, 240, 0.82));
}

.daily-spell-card-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.daily-spell-card h3,
.daily-spell-card p {
  margin: 0;
  overflow-wrap: anywhere;
}

.daily-spell-card h3 {
  font-size: 0.95rem;
}

.daily-spell-date {
  color: var(--edge);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.daily-spell-recipe {
  font-weight: 700;
}

.daily-spell-meta {
  color: var(--edge);
  font-size: 0.75rem;
}

.variant-result h3,
.variant-result p {
  grid-column: 1;
  margin: 0;
  overflow-wrap: anywhere;
}

.variant-result h3 {
  font-size: 0.95rem;
}

.variant-result p,
.variant-result code {
  color: var(--edge);
  font-size: 0.75rem;
}

.variant-result code {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
  white-space: normal;
}

.variant-result button {
  grid-column: 2;
  grid-row: 1 / 3;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--button-active);
  color: var(--ink);
  font-weight: 800;
}

.variant-result-actions {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.variant-result-actions button {
  grid-column: auto;
  grid-row: auto;
}

.variant-result-actions a.variant-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(255, 250, 240, 0.9);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.variant-dialog-action {
  display: block;
  margin-top: 14px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--button-active);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.variant-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.variant-pager button {
  min-height: 40px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 7px 14px;
  background: #fffaf0;
  color: var(--ink);
  font-weight: 800;
}

.variant-pager button:disabled {
  opacity: 0.45;
  cursor: default;
}

.wiki-reference-section {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(140, 107, 63, 0.36);
  padding: 22px 4px;
}

.variant-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  border: 2px solid var(--edge);
  border-radius: 8px;
  padding: 22px;
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
}

.variant-dialog::backdrop {
  background: rgba(20, 23, 31, 0.68);
}

.variant-dialog form {
  float: right;
}

.dialog-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: #fffaf0;
  color: var(--ink);
  font-size: 1.35rem;
}

.variant-detail-list {
  display: grid;
  gap: 10px;
}

.variant-detail-list div {
  display: grid;
  grid-template-columns: minmax(130px, 0.35fr) minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid rgba(140, 107, 63, 0.28);
  padding-top: 10px;
}

.variant-detail-list dt {
  font-weight: 800;
}

.variant-detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.source-note {
  grid-column: 1 / -1;
  border: 1px solid rgba(140, 107, 63, 0.48);
  border-radius: 10px;
  padding: 16px;
  background: rgba(255, 248, 234, 0.86);
  box-shadow: 0 12px 28px var(--shadow);
}

.source-note h2,
.source-note p {
  margin: 0;
}

.source-note p {
  margin-top: 6px;
  color: var(--edge);
  line-height: 1.45;
}

.source-links a {
  color: var(--ink);
  font-weight: 700;
}

.circle-category {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid rgba(140, 107, 63, 0.44);
  border-radius: 10px;
  padding: 14px;
  background: rgba(255, 248, 234, 0.72);
  box-shadow: 0 10px 24px rgba(36, 48, 68, 0.1);
}

.circle-category h2,
.circle-category p {
  margin: 0;
}

.circle-category h2 {
  color: var(--ink);
  font-size: 1.12rem;
}

.circle-category p {
  color: var(--edge);
  line-height: 1.35;
}

.circle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.circle-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-width: 0;
  border: 1px solid rgba(140, 107, 63, 0.36);
  border-radius: 8px;
  padding: 12px 10px 10px;
  background: rgba(255, 248, 234, 0.82);
  box-shadow: 0 8px 20px rgba(36, 48, 68, 0.1);
}

.circle-card img {
  display: block;
  width: min(100%, 142px);
  aspect-ratio: 1;
  border: 1px solid rgba(140, 107, 63, 0.18);
  border-radius: 6px;
  padding: 6px;
  background: #fffaf0;
  object-fit: contain;
}

.circle-card span {
  max-width: 100%;
  color: var(--edge);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
}

.circle-card small {
  color: rgba(140, 107, 63, 0.84);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.circle-card em {
  max-width: 100%;
  border-top: 1px solid rgba(140, 107, 63, 0.24);
  padding-top: 6px;
  color: rgba(82, 65, 44, 0.82);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-style: normal;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.circle-card-preview {
  display: grid;
  align-self: end;
  gap: 6px;
  width: 100%;
}

.circle-card-preview .circle-preview-action {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--edge);
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--button);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}

.circle-card-preview .circle-preview-action:hover,
.circle-card-preview .circle-preview-action:focus-visible {
  background: var(--button-active);
}

.circle-card-preview .circle-preview-note {
  color: rgba(82, 65, 44, 0.78);
  font-size: 0.64rem;
  font-weight: 400;
}

.library-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  border: 1px solid rgba(140, 107, 63, 0.48);
  border-radius: 10px;
  padding: 14px;
  background: rgba(255, 248, 234, 0.88);
  box-shadow: 0 12px 28px var(--shadow);
}

.library-card.simple-spell {
  border-color: rgba(199, 151, 54, 0.62);
}

.library-card.reference-card {
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
}

.library-reference-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(140, 107, 63, 0.28);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.reference-panel {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  border: 1px solid rgba(140, 107, 63, 0.48);
  border-radius: 10px;
  padding: 16px;
  background: rgba(255, 248, 234, 0.88);
  box-shadow: 0 12px 28px var(--shadow);
}

.reference-panel-copy {
  display: grid;
  gap: 10px;
}

.reference-kicker {
  margin: 0;
  color: var(--edge);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

.reference-panel h2 {
  margin: 0;
  font-size: 1.18rem;
}

.reference-panel ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--edge);
  line-height: 1.35;
}

.reference-panel img {
  display: block;
  width: 100%;
  border: 1px solid rgba(140, 107, 63, 0.24);
  border-radius: 8px;
  background: #fff;
}

.library-card h2 {
  margin: 0;
  font-size: 1.18rem;
}

.library-card p {
  margin: 6px 0 10px;
  color: var(--edge);
  line-height: 1.45;
}

.library-card dl {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 5px 9px;
  margin: 0;
}

.library-card dt {
  font-weight: 700;
}

.library-card dd {
  margin: 0;
}

.seal-diagram {
  width: 136px;
  height: 136px;
  border: 1px solid rgba(140, 107, 63, 0.28);
  border-radius: 10px;
  background: rgba(255, 248, 234, 0.72);
}

.seal-diagram svg {
  display: block;
  width: 100%;
  height: 100%;
}

.seal-line {
  fill: none;
  stroke: #201a16;
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.seal-thin {
  fill: none;
  stroke: #201a16;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.seal-fill {
  fill: #201a16;
}

.settings-card {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid rgba(140, 107, 63, 0.48);
  border-radius: 10px;
  padding: 16px;
  background: rgba(255, 248, 234, 0.86);
  box-shadow: 0 12px 28px var(--shadow);
}

.settings-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.2rem;
}

.settings-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.settings-card p,
.settings-card li {
  color: var(--edge);
  line-height: 1.45;
}

.settings-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.settings-control-card {
  grid-column: 1 / -1;
}

.settings-range {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: center;
  font-weight: 700;
  color: var(--ink);
}

.settings-range input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--gold);
}

.settings-range output {
  min-width: 4ch;
  text-align: right;
  color: var(--edge);
  font-variant-numeric: tabular-nums;
}

.select-field {
  display: grid;
  gap: 5px;
  align-content: start;
  font-weight: 700;
}

.select-field select {
  min-height: 34px;
  border: 1px solid rgba(140, 107, 63, 0.5);
  border-radius: 6px;
  padding: 5px 8px;
  background: rgba(255, 248, 234, 0.9);
  color: var(--ink);
  font: inherit;
}

.text-field {
  display: grid;
  gap: 5px;
  align-content: start;
  font-weight: 700;
}

.text-field input {
  min-height: 34px;
  min-width: 0;
  border: 1px solid rgba(140, 107, 63, 0.5);
  border-radius: 6px;
  padding: 5px 8px;
  background: rgba(255, 248, 234, 0.9);
  color: var(--ink);
  font: inherit;
}

.settings-meter {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(140, 107, 63, 0.35);
  border-radius: 8px;
  padding: 12px;
  background: rgba(246, 236, 216, 0.72);
}

.settings-meter-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  color: var(--edge);
  font-weight: 700;
}

.settings-meter-track {
  height: 8px;
  border: 1px solid rgba(140, 107, 63, 0.35);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) var(--value), rgba(255, 248, 234, 0.9) var(--value));
}

.settings-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-option-grid span {
  display: block;
  min-height: 36px;
  border: 1px solid rgba(140, 107, 63, 0.36);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(246, 236, 216, 0.72);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
}

.scene-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.scene-tile {
  min-height: 132px;
  border: 1px solid rgba(140, 107, 63, 0.42);
  border-radius: 8px;
  padding: 10px;
  background:
    radial-gradient(circle at 35% 62%, rgba(215, 166, 62, 0.28), transparent 22%),
    linear-gradient(180deg, rgba(36, 48, 68, 0.16), rgba(140, 107, 63, 0.18)),
    rgba(255, 248, 234, 0.74);
}

.scene-tile strong {
  display: block;
  margin-bottom: 6px;
}

.scene-tile span {
  display: block;
  color: var(--edge);
  line-height: 1.35;
}

.tutorial-card {
  position: relative;
  padding-top: 44px;
}

.tutorial-card p {
  margin: 0;
  color: var(--edge);
  line-height: 1.45;
}

.tutorial-reference-card {
  padding-top: 18px;
}

.tutorial-reference-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.tutorial-reference-card li {
  color: var(--edge);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.tutorial-reference-card strong {
  color: var(--gold-dark);
  font-family: var(--font-ui);
}

.element-signs {
  display: grid;
  grid-template-columns: repeat(4, 32px);
  gap: 7px;
  margin-top: 2px;
}

.element-signs span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--sign-color);
  border-radius: 50%;
  color: var(--sign-color);
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
  font-weight: 700;
}

.step-number {
  position: absolute;
  top: 14px;
  left: 16px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: var(--button-active);
  color: var(--ink);
  font-weight: 700;
}

.settings-card input:disabled {
  opacity: 0.8;
}

.settings-note {
  margin: 0;
  color: var(--edge);
  line-height: 1.4;
}

@media (min-width: 981px) and (max-height: 800px) {
  .floating-tools {
    grid-template-columns: repeat(3, 42px);
  }
}

@media (max-width: 980px) {
  .variant-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .variant-results {
    grid-template-columns: 1fr;
  }

  .tutorial-wiki-layout .tutorial-board {
    grid-template-columns: 1fr;
  }
  .simulator-page {
    overflow: auto;
  }

  .simulator-page .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .app-hub {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
  }

  .app-hub-topbar {
    grid-template-columns: 1fr;
  }

  .app-hub-shortcuts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .app-hub-gallery-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .app-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 720px;
    overflow: hidden;
  }

  .floating-tools {
    top: 12px;
    bottom: auto;
    left: 50%;
    display: flex;
    grid-auto-flow: initial;
    grid-template-columns: none;
    max-width: calc(100% - 24px);
    overflow-x: auto;
    transform: translateX(-50%);
  }

  .atelier-badge {
    left: 18px;
  }

  .canvas-wrap {
    border-right: 0;
  }

  .sidebar {
    display: flex;
    overflow: hidden;
  }

  .guide-drawer {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .ink-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grimoire {
    grid-template-columns: 1fr;
  }

  .settings,
  .commands,
  .status {
    grid-column: 1;
  }

  .command-grid {
    grid-template-columns: repeat(2, minmax(116px, 1fr));
  }

  .setting-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .range-field,
  .check-field {
    grid-column: auto;
  }

  .settings-board {
    grid-template-columns: 1fr;
  }

  .tutorial-board {
    grid-template-columns: 1fr;
  }

  .library-board {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 620px) {
  .guide-tabs {
    grid-template-columns: 1fr;
  }

  .guide-library-tools {
    grid-template-columns: 1fr;
  }

  .guide-transform-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-transform-readout {
    grid-column: 1 / -1;
  }

  .wiki-layout {
    grid-template-columns: 1fr;
  }

  .wiki-toc {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 12px;
  }

  .wiki-toc strong {
    grid-column: 1 / -1;
  }

  .wiki-section-heading {
    display: grid;
    align-items: start;
  }

  .how-output-grid {
    grid-template-columns: 1fr;
  }

  .variant-filters,
  .variant-results {
    grid-template-columns: 1fr;
  }

  .variant-filters .variant-search {
    grid-column: auto;
  }

  .variant-result {
    grid-template-columns: minmax(0, 1fr);
  }

  .variant-result button,
  .variant-result code {
    grid-column: 1;
    grid-row: auto;
  }

  .variant-result-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .variant-result-actions button,
  .variant-result-actions a.variant-action {
    width: 100%;
    min-height: 44px;
  }

  .variant-detail-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .simulator-page.symbols-open.is-dragging-symbol .symbol-drawer {
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(100% + 28px));
    transition: none;
  }

  .top-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-link {
    width: 100%;
    justify-content: center;
  }

  .header-nav {
    width: 100%;
  }

  .brand-title {
    align-items: flex-start;
  }

  .community-profile-pill {
    align-self: flex-start;
    max-width: calc(100% - 88px);
  }

  .project-support-actions { align-self: stretch; justify-content: flex-start; flex-wrap: wrap; padding-right: 64px; }
  .project-support-pill { min-height: 40px; padding: 7px 12px; }

  .brand-logo-image {
    width: 42px;
    height: 42px;
  }

  .commands button {
    width: 100%;
  }

  .commands,
  .setting-grid,
  .ink-list {
    grid-template-columns: 1fr;
  }

  .command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .atelier-badge {
    left: 12px;
    top: 12px;
    max-width: calc(100% - 172px);
  }

  .symbol-island {
    top: 12px;
    right: 12px;
    max-width: 148px;
    padding: 8px 11px;
    font-size: 0.92rem;
  }

  .composition-island {
    top: 66px;
    right: 12px;
    max-width: 148px;
    padding: 8px 11px;
    font-size: 0.92rem;
  }

  .floating-tools {
    width: calc(100% - 24px);
    display: flex;
    flex-wrap: nowrap;
    grid-auto-flow: initial;
    grid-template-columns: none;
    gap: 6px;
    border-radius: 16px;
  }

  .tool-button {
    width: 100%;
    height: 42px;
    min-height: 42px;
  }

  .range-field {
    align-items: flex-start;
    flex-direction: column;
  }

  .range-field,
  .check-field {
    grid-column: auto;
  }

  .range-field input {
    width: 100%;
  }

  .library-card {
    grid-template-columns: 1fr;
  }

  .reference-panel {
    grid-template-columns: 1fr;
  }

  .scene-preview {
    grid-template-columns: 1fr;
  }
}

/* Keep the compact palette stable after the responsive toolbar rules. */
.simulator-page.toolbar-compact .floating-tools {
  top: 16px;
  bottom: auto;
  display: flex;
  flex-direction: column;
  grid-auto-flow: initial;
  grid-template-columns: none;
  width: 60px;
  transform: none;
}

.simulator-page.toolbar-compact .floating-tools .tool-button {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
}

.simulator-page.toolbar-side.toolbar-compact .floating-tools {
  top: 50%;
  left: 18px;
  flex-direction: column;
  width: 60px;
  transform: none;
}

.simulator-page.toolbar-compact:not(.toolbar-side) .floating-tools {
  flex-direction: row;
  width: auto;
  transform: translateX(-50%);
}

@media (max-width: 980px) {
  .simulator-page.toolbar-side .floating-tools {
    top: 12px;
    left: 12px;
    width: 60px;
    max-width: none;
    flex-direction: column;
    overflow-y: auto;
    transform: none;
  }
}

.simulator-page.toolbar-side:not(.toolbar-compact) .floating-tools {
  width: max-content;
}

.symbol-search-dialog {
  width: min(520px, 92vw);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

.symbol-search-dialog::backdrop {
  background: rgba(32, 26, 22, 0.45);
}

.symbol-search-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 12px;
}

.symbol-search-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
}

.symbol-search-results {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.symbol-search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.symbol-search-result[aria-selected="true"] {
  background: rgba(159, 133, 88, 0.28);
}

.symbol-search-result .symbol-search-rune {
  margin-left: auto;
  opacity: 0.65;
  font-variant: small-caps;
}

.symbol-search-status {
  margin: 10px 0 0;
  font-size: 0.85rem;
  opacity: 0.75;
}

/* The hint must stay a SIBLING of the heading: site-i18n assigns textContent to
   every [data-i18n] node, which would delete a nested child on locale switch.
   Making the heading inline-block lets the two share a line while the following
   paragraph still starts its own. */
.symbol-drawer .panel-heading h2 {
  display: inline-block;
}

.symbol-drawer-hint {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  opacity: 0.7;
  font-size: 0.72rem;
  font-variant: small-caps;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.symbol-drag-ghost.is-armed {
  opacity: 0.55;
}

.spoiler-control {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  display: grid;
  gap: 0.45rem;
}

.spoiler-toggle {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  cursor: pointer;
}

.spoiler-range-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.spoiler-range-row input[type="range"] {
  flex: 1;
}

.spoiler-range-row output {
  min-width: 2ch;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.spoiler-note {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.75;
}

.spoiler-filter input {
  width: 5.5rem;
}

.practice-bar[hidden] {
  display: none;
}

.practice-bar {
  position: fixed;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: min(46rem, calc(100vw - 1.5rem));
  padding: 0.6rem 0.9rem;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(36, 48, 68, 0.25);
}

.practice-preview {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--paper-dark) 45%, transparent);
}

.practice-preview img,
.practice-preview svg {
  width: 60px;
  height: 60px;
}

.practice-controls {
  display: grid;
  flex: 1;
  gap: 0.45rem;
  min-width: 0;
}

.practice-target {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.practice-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
}

.practice-feedback {
  max-width: 34rem;
  margin: 0;
  overflow-wrap: anywhere;
  color: color-mix(in srgb, var(--ink) 78%, var(--paper));
  font-size: 0.78rem;
  line-height: 1.35;
}

.commands button.is-active {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.photo-dialog {
  width: min(46rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  padding: 1rem 1.25rem;
  box-sizing: border-box;
}

.sigil-composition-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  width: min(72rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  height: min(52rem, calc(100dvh - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 1rem 1.25rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-sizing: border-box;
  overflow: hidden;
}

.sigil-composition-dialog:not([open]) {
  display: none;
}

.sigil-composition-dialog::backdrop {
  background: rgba(36, 48, 68, 0.48);
}

.composition-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
}

.composition-dialog-heading h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
}

.sigil-composition-dialog > .sigil-composition-panel {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 6px 4px 0;
}

.photo-dialog::backdrop {
  background: rgba(36, 48, 68, 0.45);
}

.circle-json-export-dialog {
  width: min(42rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  padding: 1rem 1.25rem 1.15rem;
  box-sizing: border-box;
}

.circle-json-export-dialog::backdrop {
  background: rgba(36, 48, 68, 0.48);
}

.circle-json-export-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.75rem;
}

.circle-json-export-head h2 {
  margin: 0;
}

.circle-json-export-text {
  width: 100%;
  min-height: 15rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.8);
  color: var(--ink);
  font: 0.82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-sizing: border-box;
  padding: 0.75rem;
}

.circle-json-export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.circle-json-export-actions button {
  min-height: 2.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8ea;
  color: var(--ink);
  font-family: var(--label);
  font-weight: 700;
  padding: 0 1rem;
}

.circle-json-export-actions button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.photo-dialog h2 {
  margin: 0 0 0.5rem;
}

.circle-import-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.5rem 0 0.75rem;
}

.circle-import-choices button,
.circle-json-import button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8ea;
  color: var(--ink);
  font-family: var(--label);
  font-weight: 700;
}

.circle-import-choices button {
  min-height: 2.6rem;
}

.circle-json-import {
  display: grid;
  gap: 0.45rem;
  margin: 0.5rem 0 0.75rem;
}

.circle-json-import[hidden] {
  display: none;
}

.circle-json-import textarea {
  width: 100%;
  min-height: 8rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.76);
  color: var(--ink);
  font: 0.82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-sizing: border-box;
  padding: 0.65rem;
}

.circle-json-import button {
  justify-self: end;
  min-height: 2.4rem;
  padding: 0 1rem;
}

.photo-import-dropzone {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  margin: 0.5rem 0 0.75rem;
  padding: 0.8rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 234, 0.5);
  color: color-mix(in srgb, var(--ink) 78%, var(--paper));
  text-align: center;
  cursor: copy;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.photo-import-dropzone:hover,
.photo-import-dropzone:focus-visible,
.photo-import-dropzone[data-drag-active="true"] {
  border-color: var(--gold);
  background: rgba(255, 241, 214, 0.86);
  color: var(--ink);
  outline: none;
}

.photo-import-dropzone-icon {
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
}

.photo-import-dropzone small {
  color: color-mix(in srgb, var(--ink) 64%, transparent);
  font-size: 0.76rem;
}

.photo-preview-frame {
  position: relative;
  border: 1px dashed var(--line);
  border-radius: 10px;
  margin: 0.5rem 0;
  background: color-mix(in srgb, var(--paper-dark) 40%, transparent);
  overflow: hidden;
}

.photo-preview-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 52vh;
  object-fit: contain;
  user-select: none;
}

.photo-preview-overlay {
  position: absolute;
  inset: 0;
  touch-action: none;
}

.photo-region-box {
  position: absolute;
  display: block;
  min-width: 14px;
  min-height: 14px;
  padding: 0;
  border: 2px solid #3f7047;
  border-radius: 5px;
  background: rgba(63, 112, 71, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 248, 234, 0.82), 0 4px 12px rgba(36, 48, 68, 0.16);
  cursor: move;
}

.photo-region-box[data-status="ambiguous"] {
  border-color: #a8763e;
  background: rgba(168, 118, 62, 0.1);
}

.photo-region-box[data-status="unreadable"] {
  border-color: #a3523e;
  border-style: dashed;
  background: rgba(163, 82, 62, 0.08);
}

.photo-region-box[aria-pressed="true"] {
  outline: 3px solid rgba(199, 151, 54, 0.62);
  outline-offset: 2px;
  z-index: 3;
}

.photo-region-box-draft {
  border-color: var(--gold);
  border-style: dashed;
  background: rgba(199, 151, 54, 0.12);
  pointer-events: none;
}

.photo-region-handle {
  position: absolute;
  width: 0.75rem;
  height: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--ink) 58%, transparent);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 1px 4px rgba(36, 48, 68, 0.22);
}

.photo-region-handle[data-handle="nw"] {
  top: -0.42rem;
  left: -0.42rem;
  cursor: nwse-resize;
}

.photo-region-handle[data-handle="ne"] {
  top: -0.42rem;
  right: -0.42rem;
  cursor: nesw-resize;
}

.photo-region-handle[data-handle="sw"] {
  bottom: -0.42rem;
  left: -0.42rem;
  cursor: nesw-resize;
}

.photo-region-handle[data-handle="se"] {
  right: -0.42rem;
  bottom: -0.42rem;
  cursor: nwse-resize;
}

.photo-import-results {
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.photo-import-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(140, 107, 63, 0.26);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  background: rgba(255, 248, 234, 0.54);
}

.photo-import-row[data-status="ambiguous"] {
  border-color: rgba(168, 118, 62, 0.72);
  background: rgba(255, 241, 214, 0.72);
}

.photo-import-row[data-status="unreadable"] {
  border-style: dashed;
  opacity: 0.72;
}

.photo-region-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.photo-region-state {
  color: color-mix(in srgb, var(--ink) 68%, transparent);
  font-size: 0.78rem;
}

.photo-region-edit {
  min-width: 0;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.78rem;
  white-space: nowrap;
}

.photo-region-edit:hover,
.photo-region-edit:focus-visible {
  background: var(--paper-dark);
}

.photo-region-position {
  grid-column: 2 / -1;
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  color: color-mix(in srgb, var(--ink) 72%, transparent);
  font-size: 0.76rem;
}

.photo-region-position-field {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr) 3.2rem;
  align-items: center;
  gap: 0.4rem;
}

.photo-region-position-field input {
  width: 100%;
  accent-color: var(--gold);
}

.photo-region-position-field output {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.photo-import-row .photo-import-icon {
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
}

.photo-import-row .photo-import-icon svg {
  width: 100%;
  height: 100%;
}

.photo-import-meter {
  grid-column: 2 / 4;
  height: 0.35rem;
  border-radius: 999px;
  background: rgba(36, 48, 68, 0.12);
  overflow: hidden;
}

.photo-import-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--line);
}

.photo-import-meter > span[data-tier="high"] {
  background: #5d7a4e;
}

.photo-import-meter > span[data-tier="mid"] {
  background: #a8763e;
}

.photo-import-meter > span[data-tier="low"] {
  background: #a3523e;
}

.photo-import-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.photo-import-ignored {
  opacity: 0.65;
  font-style: italic;
  padding-left: 0.6rem;
}

.photo-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.photo-dialog-actions > button,
.photo-dialog-actions .dialog-close {
  flex: 1 1 10rem;
  min-width: 0;
}

.photo-dialog-actions > form {
  display: flex;
  flex: 1 1 10rem;
  min-width: 0;
  margin: 0;
}

.photo-dialog-actions > form .dialog-close {
  width: 100%;
}

@media (max-width: 560px) {
  .sigil-composition-dialog {
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
    height: calc(100dvh - 1rem);
    max-height: calc(100dvh - 1rem);
    padding: 0.85rem;
  }

  .photo-dialog {
    padding: 0.85rem;
  }

  .circle-import-choices {
    grid-template-columns: 1fr;
  }

  .photo-import-row {
    grid-template-columns: 1.5rem minmax(0, 1fr) auto auto;
  }

  .photo-dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .photo-dialog-actions > form {
    width: 100%;
  }
}

.suggestions-page {
  min-height: 100vh;
}

.suggestions-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 0.72fr) minmax(20rem, 1.28fr);
  gap: clamp(1rem, 3vw, 2.4rem);
  width: min(74rem, calc(100% - 2rem));
  margin: clamp(1rem, 4vw, 3.5rem) auto;
  align-items: start;
}

.suggestions-intro {
  padding: 0.5rem 0;
}

.suggestions-intro h2 {
  margin: 0.35rem 0 0.8rem;
  font-size: clamp(1.65rem, 3vw, 2.65rem);
  line-height: 1.08;
}

.suggestions-intro p,
.suggestions-intro li {
  line-height: 1.55;
}

.suggestions-intro ul {
  padding-left: 1.25rem;
}

.suggestion-form {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.7rem);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper) 92%, white);
  box-shadow: 0 14px 34px rgba(58, 43, 22, 0.09);
}

.suggestion-form label {
  margin-top: 0.35rem;
  font-weight: 700;
}

.suggestion-form input,
.suggestion-form select,
.suggestion-form textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 0.75rem 0.85rem;
  font: inherit;
}

.suggestion-form textarea {
  resize: vertical;
  min-height: 12rem;
}

.suggestion-form :is(input, select, textarea, button):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--gold) 65%, white);
  outline-offset: 2px;
}

.suggestion-privacy,
.suggestion-status {
  margin: 0.25rem 0;
  color: color-mix(in srgb, var(--ink) 72%, var(--paper));
  line-height: 1.4;
}

.suggestion-submit {
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 760px) {
  .app-hub {
    padding: 14px 12px;
  }

  .app-hub-home {
    gap: 14px;
  }

  .app-hub-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-hub-gallery-heading {
    display: grid;
    align-items: start;
  }

  .app-hub-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-hub-grid {
    grid-template-columns: 1fr;
  }

  .app-hub-card {
    min-height: 98px;
  }

  .suggestions-layout {
    grid-template-columns: 1fr;
  }
}

/* Compact workshop: the Grimoire becomes a bottom sheet below laptop width. */
@media (max-width: 1180px) {
  .simulator-page {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .simulator-page .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .workspace {
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .canvas-wrap {
    min-height: 0;
    overscroll-behavior: contain;
  }

  .grimoire {
    position: relative;
    z-index: 18;
    width: 100%;
    min-width: 0;
    max-height: calc(52px + env(safe-area-inset-bottom, 0px));
    padding: 0 12px env(safe-area-inset-bottom, 0px);
    overflow: hidden;
    transition: max-height 220ms ease;
  }

  .grimoire.is-open {
    max-height: min(62dvh, 620px);
  }

  .grimoire-toggle {
    display: flex;
    position: sticky;
    z-index: 2;
    top: 0;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 49px;
    border: 0;
    border-radius: 0;
    padding: 10px 12px;
    background: var(--paper);
    box-shadow: none;
    color: var(--ink);
    font-weight: 700;
  }

  .grimoire-handle {
    position: absolute;
    top: 5px;
    left: 50%;
    width: 46px;
    height: 4px;
    border-radius: 999px;
    background: rgba(140, 107, 63, 0.54);
    transform: translateX(-50%);
  }

  .grimoire-chevron {
    display: inline-block;
    font-family: "Courier New", monospace;
    transform: rotate(0deg);
    transition: transform 180ms ease;
  }

  .grimoire.is-open .grimoire-chevron {
    transform: rotate(180deg);
  }

  .grimoire-content {
    min-width: 0;
    grid-template-columns: 1fr;
    gap: 12px;
    max-height: 0;
    overflow: hidden;
    padding: 0 2px;
    opacity: 0;
    transition: opacity 150ms ease;
  }

  .grimoire.is-open .grimoire-content {
    max-height: calc(min(62dvh, 620px) - 52px - env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px 2px 14px;
    opacity: 1;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .settings,
  .commands,
  .status {
    grid-column: 1;
  }

  .settings,
  .commands {
    padding: 10px;
  }

  .command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .commands .command-button,
  .grimoire-toggle {
    min-height: 44px;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .grimoire-content {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  }

  .settings {
    grid-column: 1;
  }

  .commands {
    grid-column: 2;
  }

  .status {
    grid-column: 1 / -1;
  }

  .setting-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .range-field,
  .check-field {
    grid-column: auto;
  }
}

@media (min-width: 621px) and (max-width: 900px) {
  .setting-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .range-field,
  .check-field {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .variant-result-actions button,
  .variant-result-actions a.variant-action {
    width: 100%;
    min-height: 44px;
  }

  .top-title {
    gap: 7px;
    padding: 7px 10px 8px;
  }

  .brand-title {
    align-items: center;
    gap: 8px;
  }

  .community-profile-pill {
    max-width: calc(100% - 56px);
    min-height: 40px;
    padding: 7px 12px;
    font-size: 0.82rem;
  }

  .project-support-actions { padding-right: 48px; }
  .project-support-option { align-items: stretch; flex-direction: column; }
  .project-support-donate { text-align: center; }

  .brand-logo-image {
    width: 36px;
    height: 36px;
  }

  .top-title h1 {
    font-size: clamp(1.05rem, 5vw, 1.35rem);
  }

  .header-nav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 1px 1px 4px;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
  }

  .header-link {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    padding: 7px 10px;
    white-space: nowrap;
  }

  .language-switcher,
  .language-switcher button {
    min-height: 40px;
  }

  .language-switcher {
    grid-template-columns: repeat(2, 40px);
  }

  .setting-grid {
    grid-template-columns: 1fr;
  }

  .range-field,
  .check-field {
    width: 100%;
    min-height: 52px;
  }

  .command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .commands .command-button {
    min-height: 52px;
    padding: 8px 6px;
    font-size: 0.78rem;
  }

  .atelier-badge {
    max-width: calc(100% - 222px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .symbol-island,
  .composition-island,
  .details-island,
  .support-island,
  .guide-island {
    top: 12px;
    width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
  }

  .symbol-island { right: 204px; }
  .composition-island { right: 156px; }
  .details-island { right: 108px; }
  .support-island { right: 60px; }
  .guide-island { right: 12px; }

  .symbol-island > span:not([aria-hidden="true"]),
  .composition-island > span:not([aria-hidden="true"]),
  .details-island > span:not([aria-hidden="true"]),
  .support-island > span:not([aria-hidden="true"]),
  .guide-island > span:not([aria-hidden="true"]) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sidebar {
    top: 8px;
    right: 8px;
    bottom: 8px;
    width: calc(100% - 16px);
    padding: 12px;
  }
}

/* Keep the desktop rail toggle visible after the base display rule. */
@media (min-width: 1181px) {
  .grimoire-toggle {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workshop-menu,
  .workshop-menu-toggle,
  .workshop-menu-toggle-label,
  .workshop-menu-toggle-chevron {
    transition: none;
  }

  .grimoire,
  .grimoire-content,
  .grimoire-chevron {
    transition: none;
  }
}


/* Wide workshops keep the same bottom-sheet behavior as compact layouts. */
@media (min-width: 1181px) {
  .grimoire {
    position: relative;
    z-index: 18;
    max-height: 52px;
    padding: 0 16px 14px;
    overflow: hidden;
    transition: max-height 220ms ease;
  }

  .grimoire.is-open {
    max-height: min(46dvh, 460px);
  }

  .grimoire-toggle {
    display: flex;
    position: sticky;
    z-index: 2;
    top: 0;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: 0;
    padding: 10px 12px;
    background: var(--paper);
    box-shadow: none;
    color: var(--ink);
    font-weight: 700;
  }

  .grimoire-handle {
    position: absolute;
    top: 5px;
    left: 50%;
    width: 46px;
    height: 4px;
    border-radius: 999px;
    background: rgba(140, 107, 63, 0.54);
    transform: translateX(-50%);
  }

  .grimoire-chevron {
    display: inline-block;
    font-family: "Courier New", monospace;
    transform: rotate(0deg);
    transition: transform 180ms ease;
  }

  .grimoire.is-open .grimoire-chevron {
    transform: rotate(180deg);
  }

  .grimoire-content {
    min-width: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0 2px;
    opacity: 0;
    transition: opacity 150ms ease;
  }

  .grimoire.is-open .grimoire-content {
    max-height: calc(min(46dvh, 460px) - 52px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px 2px 14px;
    opacity: 1;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}


/* The atelier route has a dedicated bottom track so the collapsed rail stays clickable. */
@media (min-width: 1181px) {
  html[data-app-view="atelier"] .app-shell {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  html[data-app-view="atelier"] .grimoire {
    padding: 0 16px 0;
  }

  html[data-app-view="atelier"] .grimoire-toggle {
    display: flex;
  }
}

/* Keep the collapsed rail in the viewport even when the surrounding grid changes. */
.grimoire {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  width: 100%;
  min-height: 52px;
}

.grimoire-toggle {
  pointer-events: auto;
}
@media (max-width: 619px) {
  .composition-editor-shell {
    grid-template-columns: 1fr;
  }

  .composition-seal-list {
    max-height: 170px;
  }

  .composition-inspector-content {
    max-height: none;
  }
}
/* Recognition options share the grimoire's parchment controls. */
.recognition-controls { grid-column: 1 / -1; padding: 0.75rem; border: 1px solid #c6ad80; border-radius: 0.65rem; }
.recognition-controls summary { cursor: pointer; font-weight: 700; }
.recognition-controls-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; padding-top: 0.8rem; }
.recognition-controls select, .recognition-dialog select, .recognition-dialog input { width: 100%; min-width: 0; padding: 0.5rem; color: #243147; background: #fff9ed; border: 1px solid #c6ad80; border-radius: 0.4rem; font: inherit; }
.recognition-help, .recognition-status, .recognition-controls .recognition-actions { grid-column: 1 / -1; margin: 0; }
.recognition-help { font-size: 0.85rem; line-height: 1.45; }
.recognition-actions, .recognition-heading { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.recognition-heading { justify-content: space-between; }
.recognition-dialog { width: min(90vw, 800px); max-height: 85vh; overflow-y: auto; }
.recognition-group-card { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 1rem; padding: 1rem 0; border-bottom: 1px solid #c6ad80; }
.recognition-group-card img { width: 100%; height: 110px; object-fit: contain; background: white; border-radius: 0.4rem; }
.recognition-group-content { display: grid; gap: 0.65rem; }
.recognition-group-content p { margin: 0; }
@media (max-width: 600px) {
  .recognition-controls-body { grid-template-columns: minmax(0, 1fr); }
  .recognition-group-card { grid-template-columns: 65px minmax(0, 1fr); gap: 0.65rem; }
  .recognition-actions button { flex: 1 1 100%; }
}
