:root {
  --bg-1: #EEF0FA;
  --bg-2: #E6E9F7;
  --card: #FFFFFF;
  --ink: #2B2A3D;
  --muted: #8B87A3;
  --line: #EAE8F5;
  --accent: #6C63FF;
  --accent-ink: #FFFFFF;
  --accent-soft: #EFEDFF;
  --mint: #2FBF9B;
  --mint-soft: #E4F8F2;
  --coral: #E8846B;
  --coral-soft: #FCEBE5;
  --code-bg: #FBFAFF;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-soft: 0 1px 2px rgba(43,42,61,0.04), 0 12px 28px rgba(43,42,61,0.09);
  --shadow-soft-sm: 0 1px 1px rgba(43,42,61,0.04), 0 4px 10px rgba(43,42,61,0.07);
}

[data-theme="dark"] {
  --bg-1: #17162A;
  --bg-2: #1E1D33;
  --card: #23223B;
  --ink: #ECEBF7;
  --muted: #9C98BE;
  --line: #34314F;
  --accent: #8B82FF;
  --accent-ink: #14132A;
  --accent-soft: #322F58;
  --mint: #3FD8AF;
  --mint-soft: #1D3B34;
  --coral: #F0987F;
  --coral-soft: #402A2A;
  --code-bg: #1B1A30;
  --shadow-soft: 0 1px 2px rgba(0,0,0,0.25), 0 12px 28px rgba(0,0,0,0.35);
  --shadow-soft-sm: 0 1px 1px rgba(0,0,0,0.25), 0 4px 10px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, .masthead strong, .eyebrow {
  font-family: "Quicksand", ui-sans-serif, sans-serif;
}

/* ===== Header ===== */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px clamp(16px, 5vw, 64px) 8px;
}

.masthead__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.masthead__mark {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, #7D74FF, var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  font-size: 20px;
  box-shadow: var(--shadow-soft-sm);
}

.masthead__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.masthead__text strong {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.masthead__text small {
  color: var(--muted);
  font-size: 12.5px;
}

/* ===== Layout ===== */
main#app {
  flex: 1;
  padding: 12px clamp(16px, 5vw, 64px) 48px;
  display: flex;
  justify-content: center;
  position: relative;
}

.view { width: 100%; max-width: 720px; }

.masthead__actions {
  display: flex;
  gap: 10px;
}

/* ===== Card (signature: soft peeled corner) ===== */
.card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 28px clamp(18px, 4vw, 30px) 26px;
  overflow: hidden;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.card--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

/* soft "peeled note corner" signature element */
.card__peel {
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, transparent 50%, var(--bg-1) 50.5%);
  border-bottom-left-radius: 10px;
  box-shadow: -6px 6px 12px rgba(43,42,61,0.06);
  pointer-events: none;
}

/* ===== Inputs ===== */
.input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--ink);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.input--area {
  min-height: 300px;
  resize: vertical;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 10px;
  margin-bottom: 18px;
}

.input--area::placeholder { color: #B4B0C9; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field__label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 20px;
  cursor: pointer;
}

.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-family: "Quicksand", sans-serif;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn--primary {
  background: linear-gradient(145deg, #7D74FF, var(--accent));
  color: var(--accent-ink);
  box-shadow: var(--shadow-soft-sm);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn--primary:active { transform: translateY(0); }

.btn--soft {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn--soft:hover { background: #E4E1FF; }

.btn--ghost {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-soft-sm);
}

.btn--text {
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 10px 6px;
}
.btn--text:hover { color: var(--ink); }

.btn--icon {
  background: var(--bg-1);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.card__actions--wrap { flex-wrap: wrap; justify-content: center; }

/* ===== Text bits ===== */
.eyebrow {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.note {
  background: var(--coral-soft);
  color: #B75B3E;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin: 4px 0 16px;
}

.error {
  color: #C0492E;
  background: var(--coral-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 14px;
}

/* ===== Result / share card ===== */
.stub__link-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
.stub__link-row .input { text-align: center; color: var(--accent); font-weight: 600; }

.qr {
  width: 168px;
  height: 168px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft-sm);
  margin: 6px 0;
}

/* ===== Code block ===== */
.code-block {
  margin: 4px 0 20px;
  border-radius: var(--radius-md);
  background: var(--code-bg);
  border: 1px solid var(--line);
  padding: 18px 20px;
  max-height: 65vh;
  overflow: auto;
}

.code-block code {
  font-family: "JetBrains Mono", monospace !important;
  font-size: 13.5px;
  line-height: 1.65;
  background: transparent !important;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== History panel ===== */
.history-panel {
  position: fixed;
  top: 90px;
  right: clamp(12px, 4vw, 48px);
  width: min(340px, calc(100vw - 24px));
  z-index: 20;
  max-height: 70vh;
  overflow-y: auto;
}

.history-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.history-panel__head h2 { font-size: 16px; margin: 0; }

.history-list {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.history-list a {
  color: var(--ink);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}
.history-list a:hover { color: var(--accent); }

.history-list time {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

.history-list button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.history-list button:hover { color: var(--coral); }

/* ===== Footer ===== */
.foot {
  text-align: center;
  color: #A5A1BC;
  font-size: 11px;
  padding: 18px;
}

/* ===== Toast notifikasi ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  background: #23223B;
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 520px) {
  .card__actions { justify-content: center; }
  .stub__link-row { flex-direction: column; }
}
