:root {
  color-scheme: dark;
  --sea: #0c1c2e;
  --sea-2: #13283d;
  --foam: #f4efe4;
  --brass: #e4b33c;
  --muted: #8fa0b3;
  --line: rgba(244, 239, 228, 0.14);
  --dock: rgba(12, 28, 46, 0.92);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--sea);
  color: var(--foam);
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(10px + var(--safe-t)) 18px 10px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: block;
}

.brand strong {
  display: block;
  font-size: 16px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 12px;
  color: var(--brass);
  letter-spacing: 0.04em;
}

.domain {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.domain:hover { color: var(--foam); }

#app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(228, 179, 60, 0.08), transparent 60%),
    var(--sea);
}

.stage.is-hot .drop {
  outline: 2px dashed var(--brass);
  outline-offset: -18px;
  background: rgba(228, 179, 60, 0.06);
}

canvas {
  display: none;
  max-width: min(100%, 1100px);
  max-height: 100%;
  width: auto;
  height: auto;
  cursor: grab;
  touch-action: none;
}

.stage.has-image canvas { display: block; }
.stage.has-image .drop { display: none; }
.stage.has-image { flex: 0 0 clamp(280px, 55dvh, 720px); }
.stage.has-image canvas { max-height: min(55dvh, 720px); }
canvas.is-drag { cursor: grabbing; }

.drop {
  text-align: center;
  padding: 48px 24px;
  width: min(640px, calc(100% - 32px));
  border-radius: 18px;
}

.drop-kicker {
  margin: 0 0 10px;
  color: var(--brass);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.drop-title {
  margin: 0;
  font-size: clamp(40px, 8vw, 72px);
  letter-spacing: -0.045em;
  font-weight: 650;
  line-height: 0.95;
}

.image-entry-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 24px;
}

.image-entry-actions button {
  min-height: 48px;
  padding: 0 22px;
  font-size: 16px;
}

.image-entry-actions .save { min-width: min(100%, 280px); }

.image-entry-actions .ghost { border-color: rgba(244, 239, 228, 0.24); }

.drop-lede {
  margin: 16px auto 0;
  max-width: 30ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
}

.drop-sub {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.drop-note {
  margin: 22px auto 0;
  max-width: 36ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--foam);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.hint {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.dock {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  padding: 10px 14px;
  background: var(--dock);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

#dock[hidden], #editor[hidden], .layer-panel[hidden] { display: none; }

.text-tools {
  padding: 10px 14px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: var(--dock);
}

.text-tools-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.text-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.layer-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.layer-panel textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--foam);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
}

.layer-panel textarea:focus { border-color: rgba(228, 179, 60, 0.8); outline: none; }

.style-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.style-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.style-row select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sea-2);
  color: var(--foam);
  padding: 0 6px;
}

.style-row input[type="color"] {
  width: 32px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: none;
}

.style-row input[type="range"] { width: 110px; accent-color: var(--brass); }
.style-row input[type="checkbox"] { accent-color: var(--brass); }

.style-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.style-actions button { height: 36px; }

button { font: inherit; }

.ghost, .save {
  height: 42px;
  border-radius: 10px;
  padding: 0 14px;
  cursor: pointer;
}

.ghost {
  background: transparent;
  color: var(--foam);
  border: 1px solid var(--line);
}

.save {
  background: var(--brass);
  color: #1b1608;
  border: 0;
  font-weight: 700;
}

.ghost:hover, .save:hover { filter: brightness(1.06); }

.foot {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  padding: 10px 18px calc(10px + var(--safe-b));
  color: var(--muted);
  font-size: 12px;
}

.foot p { margin: 0; }

@media (max-width: 720px) {
  .domain { display: none; }
  .drop { padding: 28px 18px; }
  .drop-title { font-size: clamp(38px, 11vw, 56px); }
  .image-entry-actions { margin-top: 22px; }
  .image-entry-actions button { width: 100%; min-height: 52px; }
  .drop-sub { margin-top: 16px; }
  .drop-note { margin-top: 14px; font-size: 13px; }
  .dock { grid-template-columns: auto auto 1fr; }
  .save { flex: 1; }
  .text-tools-head { align-items: flex-start; }
  .style-row input[type="range"] { width: 90px; }
  .foot { display: none; }
}
.style-actions .danger { margin-left: auto; color: #ff8a80; border-color: rgba(255, 138, 128, 0.5); }
