/* Sakura Share — cherry blossom & violet */

:root {
  --pink-300: #ffb7c5;
  --pink-400: #ff8fb1;
  --pink-500: #f0679a;
  --purple-300: #d4b0ff;
  --purple-400: #b57bff;
  --purple-500: #9d4edd;
  --purple-600: #7b2cbf;
  --grad: linear-gradient(135deg, #ff9ec4 0%, #e07bff 52%, #8b5cf6 100%);
  --grad-soft: linear-gradient(135deg, rgba(255, 158, 196, 0.18), rgba(139, 92, 246, 0.18));
  --radius: 22px;
  --radius-sm: 14px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root,
[data-theme="light"] {
  --bg: #fff6f9;
  --blob-1: rgba(255, 183, 197, 0.6);
  --blob-2: rgba(196, 148, 255, 0.45);
  --blob-3: rgba(255, 214, 231, 0.7);
  --surface: rgba(255, 255, 255, 0.6);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --surface-sunken: rgba(250, 232, 245, 0.7);
  --border: rgba(214, 150, 200, 0.35);
  --text: #3a1d3f;
  --muted: #8c6a92;
  --accent: #b2368c;
  --ring: rgba(224, 123, 255, 0.45);
  --shadow: 0 18px 50px -18px rgba(157, 78, 221, 0.35), 0 2px 10px rgba(255, 143, 177, 0.12);
  --danger: #d6336c;
  --ok: #2f9e74;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #150a1d;
  --blob-1: rgba(240, 103, 154, 0.22);
  --blob-2: rgba(123, 44, 191, 0.38);
  --blob-3: rgba(255, 143, 177, 0.1);
  --surface: rgba(44, 21, 58, 0.55);
  --surface-strong: rgba(56, 27, 72, 0.9);
  --surface-sunken: rgba(25, 10, 34, 0.55);
  --border: rgba(214, 150, 255, 0.16);
  --text: #f8eafe;
  --muted: #bc9fca;
  --accent: #ffa3c7;
  --ring: rgba(224, 123, 255, 0.5);
  --shadow: 0 18px 50px -14px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.02);
  --danger: #ff7aa2;
  --ok: #6ee7b7;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 600px at 8% -10%, var(--blob-1), transparent 60%),
    radial-gradient(800px 700px at 105% 15%, var(--blob-2), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, var(--blob-3), transparent 60%);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}

#petals {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
[data-petals="off"] #petals { display: none; }

.topbar, main { position: relative; z-index: 1; }

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 12px;
  background: var(--grad);
  box-shadow: 0 6px 18px -6px rgba(224, 123, 255, 0.8);
  font-size: 1.1rem;
}
.brand-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub { color: var(--muted); font-weight: 500; font-size: 0.95rem; }

.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ---------------------------------------------------------------- layout */

main { max-width: 1200px; margin: 0 auto; padding: 0.5rem 1.5rem 4rem; }

main.guest {
  display: grid;
  place-items: start center;
  padding-top: 6vh;
}
main.guest > * { width: 100%; max-width: 560px; }

.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 980px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

.stack { display: grid; gap: 1rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.row > .input { width: auto; flex: 1 1 200px; }

/* ---------------------------------------------------------------- cards */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.panel-head { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 0.25rem; }
.panel-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 14px;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  font-size: 1.25rem;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-card { text-align: center; padding: 2.5rem 2rem; }
.hero-card .stack { gap: 1.25rem; }
.hero-flower {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 8px 16px rgba(240, 103, 154, 0.35));
  animation: sway 6s ease-in-out infinite;
}

.empty {
  text-align: center;
  padding: 1.5rem 1rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------------------------------------------------------------- controls */

.btn {
  --btn-bg: var(--surface-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -10px rgba(157, 78, 221, 0.6); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
  background: var(--grad);
  background-size: 160% 160%;
  border-color: transparent;
  color: #fff;
  text-shadow: 0 1px 2px rgba(80, 0, 60, 0.25);
  box-shadow: 0 10px 24px -12px rgba(224, 123, 255, 0.9);
}
.btn-primary:hover { background-position: 100% 0; box-shadow: 0 12px 28px -10px rgba(224, 123, 255, 1); }

.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 0.38rem 0.75rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 0.15s, background 0.2s;
}
.icon-btn:hover { transform: translateY(-1px) rotate(-6deg); background: var(--surface-strong); }
#theme-toggle::before { content: "☾"; }
[data-theme="dark"] #theme-toggle::before { content: "☀"; }

.icon-btn.sm { width: 2rem; height: 2rem; border-radius: 10px; font-size: 0.9rem; }

.input {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg, var(--surface-strong));
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus, .btn:focus-visible, .icon-btn:focus-visible, .dropzone:focus-visible {
  outline: none;
  border-color: var(--purple-400);
  box-shadow: 0 0 0 4px var(--ring);
}

.code-input {
  text-align: center;
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
}

.form-error { min-height: 1.4em; color: var(--danger); font-weight: 600; font-size: 0.92rem; }

/* ---------------------------------------------------------------- dropzone */

.dropzone {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  padding: 2.2rem 1rem;
  border-radius: var(--radius);
  border: 2px dashed color-mix(in srgb, var(--purple-400) 45%, transparent);
  background: var(--grad-soft);
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.dropzone:hover { border-color: var(--pink-400); }
.dropzone.over {
  transform: scale(1.015);
  border-color: var(--pink-500);
  background: linear-gradient(135deg, rgba(255, 158, 196, 0.32), rgba(139, 92, 246, 0.32));
}
.dropzone.compact { display: flex; justify-content: center; padding: 1rem; border-radius: var(--radius-sm); gap: 0.6rem; }
.dz-icon { font-size: 2rem; line-height: 1; transition: transform 0.3s; }
.dropzone.compact .dz-icon { font-size: 1.2rem; }
.dropzone:hover .dz-icon, .dropzone.over .dz-icon { transform: rotate(72deg) scale(1.1); }
.dz-title { font-weight: 700; }
.dz-hint { color: var(--muted); font-size: 0.85rem; }

/* ---------------------------------------------------------------- files */

.file-list { display: grid; gap: 0.5rem; }

.file-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  animation: rise 0.3s ease both;
}
.file-icon {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  background: var(--grad-soft);
  font-size: 1rem;
}
.file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta { color: var(--muted); font-size: 0.8rem; }
.file-actions { display: flex; gap: 0.35rem; }
.file-row.error .file-meta { color: var(--danger); }
.file-row.done .file-icon { background: color-mix(in srgb, var(--ok) 20%, transparent); }

.progress {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--purple-400) 18%, transparent);
  overflow: hidden;
  margin-top: 0.35rem;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--grad);
  transition: width 0.2s ease;
}

/* ---------------------------------------------------------------- bundles & codes */

.bundle { padding: 1.25rem; display: grid; gap: 1rem; }
.bundle.inactive { opacity: 0.78; }
.bundle-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.bundle-title { font-weight: 700; font-size: 1.02rem; }

.code-box {
  display: grid;
  gap: 0.85rem;
  padding: 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  text-align: center;
}
.code-text {
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  letter-spacing: 0.1em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  user-select: all;
  cursor: copy;
}
.code-text.used { -webkit-text-fill-color: var(--muted); text-decoration: line-through; opacity: 0.6; }

.qr {
  justify-self: center;
  width: 190px;
  height: 190px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: 0 10px 30px -12px rgba(157, 78, 221, 0.6);
  animation: rise 0.3s ease both;
}

.countdown { font-family: var(--mono); font-weight: 700; }
.countdown.urgent { color: var(--danger); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--muted);
}
.chip::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
.chip.waiting { color: var(--purple-500); }
.chip.active { color: var(--pink-500); }
.chip.active::before { animation: pulse 1.4s ease-in-out infinite; }
.chip.done { color: var(--ok); }
[data-theme="dark"] .chip.waiting { color: var(--purple-300); }
[data-theme="dark"] .chip.active { color: var(--pink-300); }

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ---------------------------------------------------------------- toast */

.toasts {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  display: grid;
  gap: 0.5rem;
  z-index: 10;
  max-width: min(380px, calc(100vw - 2.5rem));
}
.toast {
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  font-weight: 600;
  font-size: 0.92rem;
  animation: toast-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.toast.error { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.toast.leaving { animation: toast-out 0.3s ease forwards; }

/* ---------------------------------------------------------------- animation */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sway { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(1.5); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 560px) {
  .card { padding: 1.2rem; }
  .hero-card { padding: 2rem 1.2rem; }
  h1 { font-size: 1.55rem; }
  .brand-sub { display: none; }
}
