:root {
  --bg: #0c2226;
  --panel: #13343a;
  --panel-2: #1a434a;
  --text: #eef3ef;
  --muted: #a9c1bd;
  --accent: #e9a23b;
  --accent-ink: #1d1404;
  --danger: #ff8a7a;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
a { color: var(--accent); }

.top {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #ffffff14;
  flex-wrap: wrap;
}
.brand h1 { margin: 0; font-size: 1.35rem; letter-spacing: .01em; font-family: Georgia, "Times New Roman", serif; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.progress { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.bar { flex: 1; height: 8px; background: #ffffff1a; border-radius: 99px; overflow: hidden; min-width: 120px; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4fa3a5, var(--accent)); transition: width .6s; }
#count { color: var(--muted); font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

.lang {
  background: var(--panel); color: var(--text); border: 1px solid #ffffff26;
  border-radius: 8px; padding: 5px 8px; font: inherit; font-size: .85rem;
}
.timeline {
  display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto; scrollbar-width: thin;
  border-bottom: 1px solid #ffffff14;
}
.tl-item {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 5px 10px 5px 5px; border-radius: 10px; cursor: pointer; text-align: left;
  background: var(--panel); color: var(--text); border: 1px solid transparent; font: inherit;
}
.tl-item:hover { background: var(--panel-2); }
.tl-item.sel { border-color: var(--accent); }
.tl-item img, .tl-item .mys {
  width: 34px; height: 42px; object-fit: cover; border-radius: 5px; flex: none; background: #0004;
}
.tl-item.closed img { filter: saturate(.6); }
.tl-item .mys { display: grid; place-items: center; font-size: 18px; color: var(--muted); }
.tl-item .tl-txt { display: flex; flex-direction: column; line-height: 1.2; }
.tl-item .tl-month { font-weight: 600; font-size: .85rem; text-transform: capitalize; }
.tl-item .tl-sub { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.tl-item.active .tl-sub { color: var(--accent); }
.stage { position: relative; flex: 1; min-height: 320px; overflow: hidden; touch-action: none; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; display: block; }
.tip {
  position: absolute; pointer-events: none; z-index: 3;
  background: #081a1dee; border: 1px solid #ffffff22; border-radius: 8px;
  padding: 6px 9px; font-size: .85rem; max-width: 240px;
}
.tip strong { display: block; }
.tip span { color: var(--muted); }
.zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.zoom button {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid #ffffff22;
  background: var(--panel); color: var(--text); font-size: 20px; cursor: pointer;
}
.zoom button:hover { background: var(--panel-2); }
.hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: #081a1dcc; padding: 6px 12px; border-radius: 99px; font-size: .8rem; color: var(--muted);
  pointer-events: none; white-space: nowrap; max-width: calc(100% - 80px); overflow: hidden; text-overflow: ellipsis;
}
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

.foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; font-size: .78rem; color: var(--muted); border-top: 1px solid #ffffff14;
}

dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid #ffffff22;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 20px;
}
dialog::backdrop { background: #000a; }
dialog section { display: none; }
dialog[data-step="buy"] section[data-step="buy"],
dialog[data-step="upload"] section[data-step="upload"],
dialog[data-step="done"] section[data-step="done"],
dialog[data-step="view"] section[data-step="view"],
dialog[data-step="msg"] section[data-step="msg"] { display: block; }
dialog h2 { margin: 0 0 6px; font-size: 1.15rem; padding-right: 28px; }
.close {
  position: absolute; top: 10px; right: 10px; width: 32px; height: 32px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer;
}
.close:hover { background: #ffffff14; }
.row { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.preview { width: 96px; height: 96px; border-radius: 10px; flex: none; background: #0004; image-rendering: auto; }
.zone { margin: 0; color: var(--muted); }
.price { margin: 4px 0 0; font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.small { font-size: .85rem; color: var(--muted); }
.error { color: var(--danger); font-size: .9rem; }

form label { display: block; margin: 10px 0; font-size: .9rem; color: var(--muted); }
input[type="text"], input[type="file"] {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: 9px;
  border: 1px solid #ffffff26; background: #0b1f22; color: var(--text); font: inherit;
}
.previews { display: flex; gap: 14px; justify-content: center; margin: 8px 0; }
.previews figure { margin: 0; text-align: center; }
.previews canvas { width: 96px; height: 96px; border-radius: 10px; background: repeating-conic-gradient(#ffffff10 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.previews figcaption { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.keep { background: #0b1f22; border-radius: 10px; padding: 10px; font-size: .85rem; margin: 12px 0; }
.linkrow { display: flex; gap: 6px; margin-top: 6px; }
.linkrow input { margin: 0; font-size: .8rem; }
.linkrow button, .primary {
  border: 0; border-radius: 9px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.linkrow button { background: var(--panel-2); color: var(--text); }
.primary {
  display: inline-block; width: 100%; margin-top: 10px; text-align: center; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
}
.primary:disabled { opacity: .6; cursor: wait; }
.fake-pay { background: #2c7be5; color: #fff; }
#pay-box { min-height: 50px; margin-top: 12px; }

@media (max-width: 600px) {
  .brand p { display: none; }
  .brand h1 { font-size: 1.1rem; }
  .progress { min-width: 0; flex: 1; }
  .top { padding: 10px 16px; }
}
