
:root {
  --bg: #17130f;
  --panel: #251e18;
  --panel-2: #2f261f;
  --line: #4b3b2f;
  --text: #f7eddd;
  --muted: #bcae9b;
  --gold: #d2aa67;
  --gold-bright: #f0c979;
  --danger: #be5e55;
  --shadow: 0 18px 45px rgba(0,0,0,.35);
  font-family: Georgia, "Times New Roman", serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(117,86,52,.16), transparent 34rem),
    linear-gradient(135deg, #17130f, #0f0c0a);
  color: var(--text);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.site-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(24,19,15,.88);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  transform: rotate(45deg);
  background: #211a15;
  box-shadow: inset 0 0 0 5px #17130f;
}
.brand-mark::first-letter { transform: rotate(-45deg); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.4rem, 2vw, 2rem); }
h2 { font-size: 1.02rem; }
.eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  margin-bottom: 3px;
}
.header-actions, .button-row, .view-actions {
  display: flex; gap: 8px; align-items: center;
}
.app-shell {
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(420px, 1fr) minmax(290px, 350px);
  gap: 16px;
  padding: 16px;
  max-width: 1800px;
  margin: 0 auto;
}
.panel {
  background: rgba(37,30,24,.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}
.panel-section:last-child { border-bottom: 0; }
.section-heading {
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 16px;
}
.section-heading.compact { margin-bottom: 14px; }
.section-heading p {
  color: var(--muted);
  font-size: .82rem;
  margin-top: 3px;
}
.step {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #1b150f;
  background: var(--gold);
  font-weight: 700;
}
.drop-zone {
  min-height: 150px;
  border: 1px dashed #8e7657;
  background: #1d1814;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  transition: .18s ease;
}
.drop-zone:hover, .drop-zone.dragover, .drop-zone:focus {
  border-color: var(--gold-bright);
  background: #282018;
  color: var(--text);
  outline: none;
}
.drop-icon {
  font-size: 2rem;
  line-height: 1;
  color: var(--gold);
}
.drop-zone strong { color: var(--text); }
.button {
  border: 1px solid var(--line);
  background: #211a15;
  color: var(--text);
  padding: 9px 12px;
  min-height: 40px;
  transition: .16s ease;
}
.button:hover { border-color: var(--gold); transform: translateY(-1px); }
.button.primary {
  background: linear-gradient(#d7b16f, #b88743);
  border-color: #f1cb84;
  color: #1d160f;
  font-weight: 700;
}
.button.secondary { background: #30261f; }
.button.ghost { background: transparent; }
.button.danger { color: #f1aaa2; border-color: #70403b; }
.button.full { width: 100%; margin-top: 8px; min-height: 46px; }
.button-row { margin-top: 10px; }
.button-row > * { flex: 1; }
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: .84rem;
}
.field > span { display: flex; justify-content: space-between; gap: 10px; }
output { color: var(--gold-bright); }
input[type="text"], select {
  width: 100%;
  border: 1px solid var(--line);
  background: #17130f;
  color: var(--text);
  min-height: 42px;
  padding: 8px 10px;
}
input[type="range"] { width: 100%; accent-color: var(--gold); }
.toggle-field {
  display: flex; gap: 9px; align-items: center;
  color: var(--muted);
  font-size: .86rem;
  margin: 11px 0;
}
.toggle-field input { accent-color: var(--gold); }
.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 12px;
}
.color-field {
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
  border: 1px solid var(--line);
  padding: 7px 8px;
  background: #1b1612;
}
.color-field input {
  width: 42px; height: 32px;
  padding: 0; border: 0; background: transparent;
}
.shape-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.shape-button {
  min-height: 62px;
  border: 1px solid var(--line);
  background: #1d1814;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.shape-button.active {
  border-color: var(--gold);
  color: var(--text);
  background: #34291f;
}
.shape-icon {
  width: 24px; height: 24px;
  display: block;
  border: 2px solid currentColor;
}
.shape-icon.circle { border-radius: 50%; }
.shape-icon.rounded { border-radius: 7px; }
.shape-icon.hex { clip-path: polygon(25% 5%,75% 5%,100% 50%,75% 95%,25% 95%,0 50%); background: currentColor; border: 0; }
.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: #12100d;
  box-shadow: var(--shadow);
}
.workspace-toolbar, .status-bar {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #211a15;
}
.workspace-hint, .status-bar {
  color: var(--muted);
  font-size: .82rem;
}
.icon-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #18130f;
  color: var(--muted);
  padding: 7px 10px;
}
.icon-button.active { color: var(--text); border-color: var(--gold); }
.canvas-stage {
  position: relative;
  flex: 1;
  min-height: 620px;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  background-color: #14110e;
}
.canvas-stage.grid-background {
  background-image:
    linear-gradient(45deg, #28231f 25%, transparent 25%),
    linear-gradient(-45deg, #28231f 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #28231f 75%),
    linear-gradient(-45deg, transparent 75%, #28231f 75%);
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
}
#tokenCanvas {
  width: min(86%, 760px);
  height: auto;
  max-height: 86%;
  filter: drop-shadow(0 18px 24px rgba(0,0,0,.35));
  cursor: grab;
}
#tokenCanvas.dragging { cursor: grabbing; }
.empty-state {
  position: absolute;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}
.empty-state strong { color: var(--text); font-size: 1.1rem; }
.empty-state span { font-size: .82rem; }
.empty-ring {
  width: 130px; height: 130px;
  border: 9px solid #6a573f;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px #31261d, 0 0 0 2px #2c241d;
}
.status-bar { border-top: 1px solid var(--line); border-bottom: 0; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preset-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 8px; }
#presetSelect { margin-bottom: 8px; }
dialog {
  width: min(620px, calc(100% - 32px));
  color: var(--text);
  background: #211a15;
  border: 1px solid var(--gold);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.72); }
.dialog-header {
  display: flex; justify-content: space-between; align-items: start;
  gap: 20px; padding: 18px;
  border-bottom: 1px solid var(--line);
}
.dialog-content { padding: 18px; color: var(--muted); line-height: 1.55; }
.tip-card {
  display: grid; gap: 4px;
  border: 1px solid var(--line);
  background: #17130f;
  padding: 12px;
  margin-top: 12px;
}
.tip-card strong { color: var(--gold-bright); }

@media (max-width: 1150px) {
  .app-shell { grid-template-columns: 300px 1fr; }
  .design-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); }
  .design-panel .panel-section { border-right: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .site-header { position: static; align-items: flex-start; padding: 12px; }
  .header-actions { flex-direction: column; align-items: stretch; }
  .app-shell { display: block; padding: 8px; }
  .panel, .workspace { margin-bottom: 10px; }
  .canvas-stage { min-height: 420px; }
  .design-panel { display: block; }
  .workspace-toolbar { align-items: flex-start; }
}

.empty-state[hidden] { display: none !important; }

.version-tag {
  display: inline-block;
  margin-left: 7px;
  color: var(--gold);
  font-size: .72rem;
  vertical-align: middle;
  letter-spacing: .08em;
}

.shape-icon.gear {
  border: 0;
  background: currentColor;
  clip-path: polygon(42% 0,58% 0,62% 15%,72% 19%,84% 10%,94% 21%,85% 33%,90% 43%,100% 46%,100% 61%,85% 65%,81% 75%,91% 87%,80% 97%,68% 87%,58% 91%,55% 100%,40% 100%,37% 86%,27% 82%,15% 92%,5% 81%,15% 68%,10% 58%,0 55%,0 40%,15% 36%,19% 26%,9% 14%,20% 4%,32% 14%);
  position: relative;
}
.color-field input:disabled { opacity: .38; cursor: not-allowed; }
.label-color-grid { margin-top: 4px; }

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brand-subtitle {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}


/* Desktop preview positioning refinement
   Keep the token preview near the top of the workspace instead of vertically
   centering it in the very tall middle column. */
@media (min-width: 761px) {
  .canvas-stage {
    place-items: start center;
    padding: 34px 24px 24px;
  }

  #tokenCanvas {
    width: min(76%, 680px);
    max-height: calc(100% - 58px);
  }
}


/* iPhone photo export fallback dialog */
.ios-save-button,
.ios-save-help {
  display: none;
}

.photo-save-content {
  text-align: center;
}

.photo-save-content img {
  display: block;
  width: min(520px, 100%);
  height: auto;
  margin: 14px auto 18px;
  background: #0b0a0e;
  border: 1px solid var(--line);
}
