*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f7f0e5;
  --bg-soft: #fbf7f0;
  --surface: rgba(255, 250, 242, 0.9);
  --surface-strong: #fffaf4;
  --surface-soft: rgba(255, 255, 255, 0.72);
  --surface-panel: rgba(255, 247, 235, 0.94);
  --border: rgba(203, 162, 111, 0.36);
  --border-strong: rgba(184, 126, 67, 0.48);
  --text: #312419;
  --text-muted: #81684f;
  --accent: #d78635;
  --accent-deep: #b86828;
  --accent-soft: #efbf8f;
  --royal: #4e6982;
  --royal-deep: #364c61;
  --royal-soft: rgba(105, 137, 168, 0.18);
  --danger: #b55443;
  --success: #66845f;
  --shadow: 0 24px 48px rgba(110, 69, 24, 0.12);
  --radius: 22px;
  --sidebar-w: 280px;
  --font: "Trebuchet MS", "Segoe UI", sans-serif;
  --strip-h: 18px;
}

body.theme-dark {
  --bg: #16191e;
  --bg-soft: #1d232b;
  --surface: rgba(27, 33, 41, 0.9);
  --surface-strong: #232a33;
  --surface-soft: rgba(31, 38, 47, 0.82);
  --surface-panel: rgba(26, 32, 39, 0.95);
  --border: rgba(132, 154, 181, 0.22);
  --border-strong: rgba(215, 134, 53, 0.34);
  --text: #eef2f6;
  --text-muted: #aeb8c4;
  --accent: #e39b49;
  --accent-deep: #c67c30;
  --accent-soft: #f0bb79;
  --royal: #89a7c2;
  --royal-deep: #dce8f3;
  --royal-soft: rgba(137, 167, 194, 0.16);
  --danger: #df7f74;
  --success: #86b08b;
  --shadow: 0 28px 56px rgba(0, 0, 0, 0.34);
}

html, body {
  height: 100%;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(215, 134, 53, 0.17), transparent 28%),
    radial-gradient(circle at bottom right, rgba(78, 105, 130, 0.14), transparent 24%),
    linear-gradient(180deg, #fcf7ef 0%, #f5ecde 100%);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

body.theme-dark {
  background:
    radial-gradient(circle at top left, rgba(227, 155, 73, 0.16), transparent 26%),
    radial-gradient(circle at bottom right, rgba(137, 167, 194, 0.12), transparent 22%),
    linear-gradient(180deg, #11161c 0%, #181f27 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: none;
  cursor: pointer;
}

#app {
  display: flex;
  height: 100vh;
}

#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 248, 238, 0.88);
  border-right: 1px solid rgba(203, 162, 111, 0.28);
  backdrop-filter: blur(18px);
}

body.theme-dark #sidebar {
  background: rgba(17, 22, 28, 0.88);
  border-right-color: rgba(132, 154, 181, 0.18);
}

.sidebar-header {
  padding: 18px 18px 10px;
}

.mirror-brand {
  position: relative;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: 24px;
  text-align: left;
  color: #fbf7f2;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.08)),
    linear-gradient(135deg, rgba(78, 105, 130, 0.92), rgba(215, 134, 53, 0.88));
  border: 1px solid rgba(255,255,255,0.26);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.42),
    0 18px 32px rgba(70, 88, 103, 0.26);
}

.mirror-brand-glow {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.42), transparent 36%),
    radial-gradient(circle at top right, rgba(255,255,255,0.3), transparent 30%);
  pointer-events: none;
}

.mirror-brand-word,
.mirror-brand-sub {
  position: relative;
  z-index: 1;
}

.mirror-brand-word {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.mirror-brand-sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}

.sidebar-view-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 18px 14px;
}

.sidebar-theme-row {
  padding: 0 18px 14px;
}

.sidebar-theme-btn {
  width: 100%;
}

.sidebar-section-label {
  padding: 0 18px 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#location-list {
  flex: 1;
  padding: 2px 0 12px;
  overflow-y: auto;
}

.loc-nav-item {
  width: calc(100% - 24px);
  margin: 0 12px 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 16px;
  color: var(--text-muted);
  background: transparent;
  transition: background .14s, transform .14s, color .14s;
}

.loc-nav-item:hover {
  background: rgba(255,255,255,0.62);
  color: var(--text);
  transform: translateX(2px);
}

.loc-nav-item.active {
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(243, 224, 197, 0.86));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(203, 162, 111, 0.22);
}

body.theme-dark .loc-nav-item:hover {
  background: rgba(255,255,255,0.08);
}

body.theme-dark .loc-nav-item.active {
  background: linear-gradient(135deg, rgba(137, 167, 194, 0.18), rgba(227, 155, 73, 0.12));
  box-shadow: inset 0 0 0 1px rgba(132, 154, 181, 0.18);
}

.loc-nav-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(203, 162, 111, 0.34);
}

.loc-nav-icon img,
.loc-nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 20px;
  border-top: 1px solid rgba(203, 162, 111, 0.24);
}

#main {
  flex: 1;
  overflow-y: auto;
}

.view {
  display: none;
  min-height: 100%;
}

.view.active {
  display: block;
}

.page-shell,
.landing-shell {
  padding: 28px 34px 40px;
}

.protocol-banner,
.protocol-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--royal-deep);
  background: rgba(78, 105, 130, 0.08);
  border: 1px solid rgba(78, 105, 130, 0.18);
}

.protocol-banner {
  margin-bottom: 18px;
}

.protocol-note {
  margin-top: 10px;
  font-size: 12px;
}

.protocol-banner strong,
.protocol-note strong {
  font-family: Georgia, "Times New Roman", serif;
}

.protocol-banner code,
.protocol-note code {
  font-size: 11px;
}

body.theme-dark .protocol-banner,
body.theme-dark .protocol-note {
  color: var(--royal-deep);
  background: rgba(137, 167, 194, 0.08);
  border-color: rgba(137, 167, 194, 0.18);
}

.eyebrow {
  margin-bottom: 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--royal);
}

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

.page-header h1,
.section-heading h2,
.landing-copy h1,
.location-title-wrap h1,
.mirror-card h2,
.story-card h2,
.help-card h2 {
  font-family: Georgia, "Times New Roman", serif;
}

.page-header h1,
.landing-copy h1 {
  line-height: 1.03;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(340px, 1.12fr);
  gap: 24px;
}

.landing-copy,
.landing-showcase,
.landing-stats-panel,
.story-card,
.help-card,
.mirror-card,
.mock-card,
.zone-card,
.modal,
.help-shell .page-header,
.mirror-stage-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

body.theme-dark .landing-showcase,
body.theme-dark .landing-stats-panel {
  background:
    radial-gradient(circle at top right, rgba(137, 167, 194, 0.12), transparent 30%),
    radial-gradient(circle at bottom left, rgba(227, 155, 73, 0.16), transparent 24%),
    var(--surface);
}

.landing-copy,
.landing-showcase,
.landing-stats-panel,
.help-shell .page-header {
  border-radius: 30px;
  padding: 30px;
}

.landing-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 24px 28px;
}

.landing-copy h1 {
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.08;
  margin-bottom: 4px;
}

.landing-copy p,
.landing-note,
.story-card p,
.section-heading p,
.help-card p,
.page-header p,
.mirror-card p,
.mirror-stage-note {
  color: var(--text-muted);
  line-height: 1.66;
}

.landing-copy p {
  max-width: 36ch;
  font-size: 15px;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.landing-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.landing-showcase {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  background:
    radial-gradient(circle at top right, rgba(78, 105, 130, 0.12), transparent 30%),
    radial-gradient(circle at bottom left, rgba(215, 134, 53, 0.18), transparent 24%),
    var(--surface);
}

.landing-stats-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    radial-gradient(circle at top right, rgba(78, 105, 130, 0.12), transparent 30%),
    radial-gradient(circle at bottom left, rgba(215, 134, 53, 0.14), transparent 24%),
    var(--surface);
}

.landing-stats-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.landing-stats-head h2,
.landing-activity-head h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.landing-stats-head p {
  max-width: 260px;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 13px;
}

.landing-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.landing-stat-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 18px;
  background: rgba(255,255,255,0.48);
  border: 1px solid rgba(203, 162, 111, 0.18);
}

.landing-stat-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1;
}

.landing-stat-card span {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.landing-activity {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(203, 162, 111, 0.16);
}

.landing-activity-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.landing-activity-head span {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.landing-activity-list {
  display: grid;
  gap: 10px;
}

.landing-activity-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(203, 162, 111, 0.16);
}

.landing-activity-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.landing-activity-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.landing-activity-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.landing-activity-body strong {
  font-size: 14px;
  line-height: 1.45;
}

.landing-activity-body span {
  color: var(--text-muted);
  font-size: 12px;
}

.landing-mirror-stack {
  display: flex;
  justify-content: center;
}

.landing-mirror-panel {
  width: min(100%, 430px);
  padding: 18px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.38);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.38), rgba(255,255,255,0.12)),
    linear-gradient(160deg, rgba(78, 105, 130, 0.14), rgba(215, 134, 53, 0.12));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.landing-mirror-title {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--royal);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.landing-mirror-body {
  padding: 20px;
  border-radius: 24px;
  background: rgba(255,255,255,0.36);
  border: 1px solid rgba(255,255,255,0.42);
}

.hero-wordmark {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-wordmark-gap {
  flex-basis: 100%;
  height: 0;
}

.brand-tile {
  position: relative;
  width: clamp(60px, 7vw, 78px);
  aspect-ratio: 1;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.45);
  box-shadow: 0 18px 28px rgba(92, 63, 35, 0.16);
}

.brand-tile span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 34px);
  color: #fff8f1;
  text-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.landing-note {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.54);
}

.landing-story,
.help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.story-card,
.help-card,
.mirror-card,
.mock-card {
  border-radius: 24px;
  padding: 22px;
}

.story-card h2,
.help-card h2,
.mirror-card h2 {
  font-size: 26px;
  margin-bottom: 10px;
}

.landing-mocks {
  margin-top: 28px;
}

.landing-mock-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.mock-card h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  margin-bottom: 6px;
}

.mock-card p {
  color: var(--text-muted);
  line-height: 1.62;
  margin-bottom: 14px;
}

.mock-zone-preview {
  min-height: 180px;
  padding: 16px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.46), rgba(255,255,255,0.22)),
    linear-gradient(180deg, rgba(78, 105, 130, 0.08), rgba(215, 134, 53, 0.08));
  border: 1px solid rgba(203, 162, 111, 0.24);
}

.mirror-shell {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.mirror-layout {
  display: grid;
  grid-template-columns: minmax(250px, 290px) minmax(340px, 1fr) minmax(280px, 340px);
  gap: 18px;
  align-items: start;
}

.mirror-controls,
.mirror-sidepanel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mirror-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.mirror-control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.mirror-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.mirror-search,
.mirror-label input {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.76);
  color: var(--text);
  outline: none;
}

.mirror-search:focus,
.mirror-label input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(215, 134, 53, 0.1);
}

.mirror-stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mirror-stage-frame {
  border-radius: 34px;
  padding: 18px;
}

.mirror-stage {
  position: relative;
  width: 100%;
  min-height: 720px;
  border-radius: 28px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.52), rgba(255,255,255,0.1)),
    linear-gradient(180deg, rgba(78, 105, 130, 0.1), rgba(215, 134, 53, 0.08)),
    rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255,255,255,0.4);
}

.mirror-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255,255,255,0.18), transparent 28%),
    linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.06) 100%);
  pointer-events: none;
}

.mirror-stage-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.7;
  z-index: 0;
}

.mirror-subject-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
}

.mirror-piece-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.mirror-piece {
  position: absolute;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.mirror-piece.dragging {
  cursor: grabbing;
}

.mirror-piece-visual {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.75);
  box-shadow: 0 20px 26px rgba(54, 76, 97, 0.18);
  background: rgba(255,255,255,0.74);
}

.mirror-piece-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.mirror-piece.selected .mirror-piece-visual {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(215, 134, 53, 0.18), 0 22px 28px rgba(54, 76, 97, 0.18);
}

.mirror-piece-list,
.mirror-look-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  max-height: 360px;
  overflow-y: auto;
}

.mirror-piece-entry,
.mirror-look-entry {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255,255,255,0.56);
  border: 1px solid rgba(203, 162, 111, 0.22);
}

.mirror-piece-thumb,
.mirror-look-thumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(203, 162, 111, 0.28);
  background: rgba(255,255,255,0.7);
}

.mirror-piece-thumb img,
.mirror-look-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mirror-piece-meta,
.mirror-look-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mirror-piece-meta strong,
.mirror-look-meta strong {
  font-size: 14px;
}

.mirror-piece-meta span,
.mirror-look-meta span,
.mirror-stage-note,
#mirror-piece-count,
#mirror-look-count,
#mirror-scale-value,
#mirror-rotate-value {
  color: var(--text-muted);
  font-size: 12px;
}

.mirror-piece-actions,
.mirror-look-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.mirror-selected-controls.hidden,
.hidden {
  display: none !important;
}

.mirror-selected-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.mirror-selected-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.mirror-selected-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.help-shell {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.location-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 28px 34px 18px;
  border-bottom: 1px solid rgba(203, 162, 111, 0.24);
}

.location-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#loc-name {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
  outline: none;
  border-bottom: 1px dashed transparent;
}

#loc-name:focus {
  border-bottom-color: var(--accent);
}

#loc-type-badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--royal);
  background: rgba(78, 105, 130, 0.08);
  border: 1px solid rgba(78, 105, 130, 0.18);
}

.location-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.location-reference-panel {
  margin: 24px 34px 0;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 360px);
  gap: 18px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.location-reference-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.location-reference-copy h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.location-reference-copy p {
  color: var(--text-muted);
}

.location-reference-photo {
  min-height: 180px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(203, 162, 111, 0.24);
  background: rgba(255,255,255,0.76);
}

.location-reference-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#zones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  padding: 24px 34px 38px;
}

.zone-card {
  border-radius: 24px;
  overflow: hidden;
  transition: transform .14s, box-shadow .14s;
  cursor: pointer;
}

.zone-card:hover {
  transform: translateY(-3px);
}

.zone-card-pattern {
  height: 124px;
  overflow: hidden;
}

.zone-card-photo {
  height: 124px;
  overflow: hidden;
  border-bottom: 1px solid rgba(203, 162, 111, 0.16);
}

.zone-card-pattern svg {
  width: 100%;
  height: 100%;
  display: block;
}

.zone-card-photo img,
.zone-image-display img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.zone-card-browse .zone-card-visual {
  min-height: 196px;
  padding: 16px;
  position: relative;
  background:
    radial-gradient(circle at top right, rgba(78, 105, 130, 0.12), transparent 30%),
    radial-gradient(circle at bottom left, rgba(215, 134, 53, 0.16), transparent 24%),
    linear-gradient(180deg, rgba(255,255,255,0.6), rgba(244, 230, 210, 0.6));
}

.zone-card-browse-photo {
  position: absolute;
  inset: 0;
  opacity: 0.18;
}

.zone-card-browse-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.zone-card-pattern-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(203, 162, 111, 0.26);
  box-shadow: 0 14px 22px rgba(90, 60, 25, 0.14);
}

.zone-card-info {
  padding: 14px 16px 16px;
}

.zone-card-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
}

.zone-card-count,
.zone-card-layout,
#zone-item-count,
.zone-detail-sub,
.item-detail-meta,
.item-detail-readonly,
.slider-value,
.ctx-menu-header,
.ctx-menu-empty {
  color: var(--text-muted);
  font-size: 12px;
}

.zone-card-count,
.zone-card-layout {
  margin-top: 6px;
}

.btn-primary,
.btn-ghost,
.btn-danger-ghost,
.btn-icon,
.layout-btn-group button,
.sidebar-nav-btn {
  border-radius: 14px;
  transition: background .14s, color .14s, transform .14s, box-shadow .14s, border-color .14s;
}

.btn-primary,
.btn-ghost,
.btn-danger-ghost,
.layout-btn-group button,
.layout-column-input,
.modal input[type="text"],
.modal select,
.modal input[type="range"] {
  border: 1px solid var(--border);
}

.btn-primary {
  padding: 10px 16px;
  color: #fff8f1;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 12px 22px rgba(184, 104, 40, 0.18);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-ghost,
.sidebar-nav-btn,
.layout-btn-group button {
  padding: 9px 14px;
  color: var(--text);
  background: rgba(255,255,255,0.6);
}

.btn-ghost:hover,
.sidebar-nav-btn:hover,
.layout-btn-group button:hover {
  background: rgba(255,255,255,0.86);
}

body.theme-dark .btn-ghost,
body.theme-dark .sidebar-nav-btn,
body.theme-dark .layout-btn-group button,
body.theme-dark .row-reference-tab,
body.theme-dark .btn-icon,
body.theme-dark .mirror-search,
body.theme-dark .mirror-label input,
body.theme-dark .modal input[type="text"],
body.theme-dark .modal select,
body.theme-dark .layout-column-input,
body.theme-dark .row-reference-card,
body.theme-dark .stack-row-topdown,
body.theme-dark #item-strip-preview,
body.theme-dark .mirror-piece-entry,
body.theme-dark .mirror-look-entry,
body.theme-dark .location-reference-photo,
body.theme-dark .row-reference-preview,
body.theme-dark .zone-image-display,
body.theme-dark #zone-pattern-display,
body.theme-dark #item-detail-img,
body.theme-dark .ctx-menu {
  background: rgba(27, 33, 41, 0.88);
  color: var(--text);
  border-color: rgba(132, 154, 181, 0.2);
}

body.theme-dark .btn-ghost:hover,
body.theme-dark .sidebar-nav-btn:hover,
body.theme-dark .layout-btn-group button:hover,
body.theme-dark .row-reference-tab:hover,
body.theme-dark .btn-icon:hover {
  background: rgba(255,255,255,0.12);
}

body.theme-dark .mirror-piece-visual,
body.theme-dark .mirror-piece-thumb,
body.theme-dark .mirror-look-thumb,
body.theme-dark .stack-empty-slot {
  background: rgba(31, 38, 47, 0.88);
  border-color: rgba(132, 154, 181, 0.22);
}

body.theme-dark .mirror-stage {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
    linear-gradient(180deg, rgba(137, 167, 194, 0.08), rgba(227, 155, 73, 0.06)),
    rgba(20, 25, 31, 0.84);
  border-color: rgba(132, 154, 181, 0.18);
}

body.theme-dark .landing-mirror-panel,
body.theme-dark .mock-zone-preview,
body.theme-dark .zone-card-browse .zone-card-visual,
body.theme-dark .landing-note,
body.theme-dark .landing-stat-card,
body.theme-dark .landing-activity {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
    linear-gradient(180deg, rgba(137, 167, 194, 0.08), rgba(227, 155, 73, 0.06));
  border-color: rgba(132, 154, 181, 0.18);
}

body.theme-dark .mode-toggle {
  background: rgba(255,255,255,0.06);
  border-color: rgba(132, 154, 181, 0.16);
}

.btn-danger-ghost {
  padding: 9px 14px;
  color: var(--danger);
  background: rgba(181, 84, 67, 0.08);
}

.btn-danger-ghost:hover {
  background: rgba(181, 84, 67, 0.16);
}

.btn-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.6);
  color: var(--text-muted);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
}

.btn-file {
  display: inline-flex;
  align-items: center;
}

.btn-file input {
  display: none;
}

.sidebar-nav-btn.active,
.sidebar-theme-btn.active,
.mode-toggle button.active,
.layout-btn-group button.active {
  color: #f7fbff;
  background: linear-gradient(135deg, var(--royal), var(--royal-deep));
  border-color: transparent;
}

.mode-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(203, 162, 111, 0.22);
}

.mode-toggle button {
  min-width: 74px;
  border-radius: 999px;
}

.mode-edit .readonly-only {
  display: none;
}

.mode-browse .edit-only {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 58, 38, 0.34);
  backdrop-filter: blur(10px);
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: 440px;
  max-width: 95vw;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 28px;
  padding: 28px;
}

.modal-wide {
  width: 920px;
  max-width: 96vw;
}

.modal h2,
.zone-detail-header h2,
.item-detail-header h2 {
  font-size: 30px;
  font-family: Georgia, "Times New Roman", serif;
}

.modal label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.modal input[type="text"],
.modal select,
.layout-column-input {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.76);
  color: var(--text);
  outline: none;
}

.modal input[type="text"]:focus,
.modal select:focus,
.layout-column-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(215, 134, 53, 0.1);
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.zone-detail-header,
.item-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.zone-detail-header h2 {
  outline: none;
  border-bottom: 1px dashed transparent;
}

.zone-detail-header h2:focus {
  border-bottom-color: var(--accent);
}

.zone-detail-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
}

.zone-pattern-panel,
.zone-items-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#zone-pattern-display {
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 1;
  background: rgba(255,255,255,0.76);
  border: 1px solid rgba(203, 162, 111, 0.26);
}

#zone-pattern-display img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.zone-image-display {
  aspect-ratio: 1.15;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255,255,255,0.76);
  border: 1px solid rgba(203, 162, 111, 0.26);
}

.zone-row-reference-list {
  display: grid;
  gap: 10px;
}

.row-reference-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-reference-tab {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(203, 162, 111, 0.22);
  background: rgba(255,255,255,0.56);
  color: var(--text);
}

.row-reference-tab.active {
  color: #f7fbff;
  background: linear-gradient(135deg, var(--royal), var(--royal-deep));
  border-color: transparent;
}

.row-reference-card {
  padding: 10px;
  display: grid;
  gap: 8px;
  border-radius: 18px;
  background: rgba(255,255,255,0.66);
  border: 1px solid rgba(203, 162, 111, 0.2);
}

.row-reference-card-active {
  padding: 14px;
}

.row-reference-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.row-reference-helper {
  color: var(--text-muted);
  font-size: 12px;
}

.row-reference-preview {
  min-height: 110px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-muted);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.68), rgba(244, 230, 210, 0.52));
  border: 1px solid rgba(203, 162, 111, 0.16);
}

.row-reference-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.row-reference-preview span {
  padding: 16px;
  font-size: 12px;
}

.row-reference-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.label-photo-empty {
  width: 100%;
  height: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--text-muted);
}

.label-photo-empty strong {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
}

#zone-pattern-display svg {
  width: 100%;
  height: 100%;
}

.zone-items-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

#zone-layout-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 0 8px;
  border-top: 1px solid rgba(203, 162, 111, 0.2);
  border-bottom: 1px solid rgba(203, 162, 111, 0.2);
}

.layout-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.layout-group-labels {
  flex: 1 1 220px;
}

.layout-label,
.item-strip-preview-label,
.stack-col-label,
.stack-row-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.layout-btn-group,
.layout-column-labels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.layout-column-input {
  width: 90px;
  font-size: 12px;
}

#zone-items-grid {
  max-height: 460px;
  overflow: auto;
  padding-bottom: 4px;
}

.zone-stack-root {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}

.zone-stack-root.compact {
  gap: 8px;
}

.stack-col-wrap {
  min-width: 138px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zone-stack-root.compact .stack-col-wrap {
  min-width: 80px;
}

.stack-col-label {
  text-align: center;
}

.stack-depth-wrap,
.stack-topdown-wrap,
.stack-lane,
.stack-add-row,
.stack-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stack-depth-wrap {
  position: relative;
}

.stack-row {
  width: 100%;
}

.stack-row-front {
  position: relative;
  z-index: 3;
}

.stack-row-back {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.stack-row-topdown {
  padding: 8px;
  border-radius: 16px;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(203, 162, 111, 0.2);
}

.stack-empty-slot {
  min-height: var(--strip-h);
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px dashed rgba(203, 162, 111, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: rgba(255,255,255,0.52);
  font-size: 11px;
}

.zone-stack-root.compact .stack-empty-slot {
  min-height: 12px;
  padding: 4px;
  font-size: 0;
}

.stack-drop-slot {
  height: 10px;
  border-radius: 999px;
  border: 1px dashed transparent;
}

.stack-drop-slot.drag-over,
.stack-drop-slot:hover,
.stack-empty-slot.drag-over {
  border-color: var(--accent);
  background: rgba(215, 134, 53, 0.14);
}

.spine-strip {
  position: relative;
  width: 100%;
  height: var(--strip-h);
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(203, 162, 111, 0.44);
  background: rgba(255,255,255,0.78);
  box-shadow: 0 10px 18px rgba(98, 65, 27, 0.08);
  transition: height .12s, transform .12s, border-color .12s, box-shadow .12s;
}

.spine-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.spine-strip:hover {
  height: calc(var(--strip-h) * 2.2);
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 18px 24px rgba(98, 65, 27, 0.14);
  z-index: 10;
}

.spine-strip::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(49, 36, 25, 0.92);
  color: #fff8f0;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
}

.spine-strip:hover::after {
  opacity: 1;
}

.spine-strip.dragging {
  opacity: 0.35;
}

#item-detail-img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 20px;
  background: rgba(255,255,255,0.76);
  border: 1px solid rgba(203, 162, 111, 0.26);
}

#item-strip-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#item-strip-preview {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.58);
  border: 1px solid rgba(203, 162, 111, 0.22);
}

.ctx-menu {
  position: fixed;
  min-width: 220px;
  max-width: 300px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 2000;
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.98);
  border: 1px solid rgba(203, 162, 111, 0.3);
  box-shadow: var(--shadow);
}

.ctx-menu.hidden {
  display: none;
}

.ctx-menu-header {
  padding: 12px 14px 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(203, 162, 111, 0.18);
}

.ctx-menu-item,
.ctx-menu-empty {
  width: 100%;
  padding: 10px 14px;
}

.ctx-menu-item {
  text-align: left;
  background: transparent;
  color: var(--text);
}

.ctx-menu-item:hover {
  background: rgba(255,255,255,0.74);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(203, 162, 111, 0.7);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1180px) {
  .landing-hero,
  .landing-story,
  .landing-mock-grid,
  .help-grid,
  .mirror-layout,
  .location-reference-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  #app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  #sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid rgba(203, 162, 111, 0.24);
  }

  #main {
    overflow: visible;
  }

  .page-shell,
  .landing-shell,
  .location-header,
  #zones-grid,
  .location-reference-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .location-reference-panel {
    margin-left: 18px;
    margin-right: 18px;
  }

  .page-header,
  .section-heading,
  .location-header,
  .zone-items-toolbar,
  .landing-stats-head,
  .landing-activity-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .landing-stat-grid {
    grid-template-columns: 1fr;
  }

  .landing-activity-row {
    display: flex;
  }

  .zone-detail-body {
    grid-template-columns: 1fr;
  }

  .mirror-stage {
    min-height: 560px;
  }
}
