:root {
  --ink: #102a2a;
  --muted: #687b79;
  --mint: #13ad88;
  --mint-dark: #08775e;
  --mint-soft: #e8f8f3;
  --paper: rgba(255, 255, 255, .9);
  --line: #dcebe7;
  --danger: #c84d58;
  --shadow: 0 24px 70px rgba(34, 102, 85, .13);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #f4fbf8; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(110, 221, 184, .17), transparent 28rem),
    radial-gradient(circle at 90% 0%, rgba(114, 188, 255, .12), transparent 30rem),
    linear-gradient(180deg, #f7fcfa 0%, #eff9f5 100%);
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.background-orb {
  position: fixed;
  z-index: -1;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .2;
  pointer-events: none;
}
.orb-one { top: 8rem; left: -10rem; background: #62d7b6; }
.orb-two { right: -10rem; bottom: 5rem; background: #8ac7f2; }

.page-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 66px 0 30px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.eyebrow, .section-kicker {
  margin: 0 0 9px;
  color: var(--mint-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(36px, 6vw, 62px); line-height: 1.04; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 24px; letter-spacing: -.02em; }
.hero-copy { margin: 0; color: var(--muted); font-size: 16px; }

.privacy-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border: 1px solid #bfe6d9;
  border-radius: 999px;
  color: var(--mint-dark);
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 30px rgba(44, 125, 103, .08);
  font-size: 14px;
  font-weight: 750;
}
.privacy-badge span { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(19, 173, 136, .12); }

.workspace { display: grid; grid-template-columns: minmax(0, .93fr) minmax(0, 1.07fr); gap: 22px; align-items: stretch; }

.panel {
  border: 1px solid rgba(194, 223, 215, .82);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.generator-panel, .code-panel { min-height: 512px; padding: 30px; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.section-heading p:not(.section-kicker) { margin: 7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.text-button, .danger-text-button {
  border: 0;
  padding: 6px 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.text-button:hover { color: var(--mint-dark); }
.danger-text-button { color: var(--danger); }
.danger-text-button:disabled { opacity: .38; cursor: default; }

.field-label { display: block; margin: 0 0 9px; font-size: 14px; font-weight: 750; }
input[type="text"], input[type="password"] {
  width: 100%;
  height: 54px;
  margin: 0 0 20px;
  border: 1px solid #cfe2dc;
  border-radius: 15px;
  outline: none;
  padding: 0 16px;
  color: var(--ink);
  background: #fbfefd;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input:focus { border-color: #58c5a6; background: #fff; box-shadow: 0 0 0 4px rgba(19, 173, 136, .11); }
input::placeholder { color: #9aaca8; }

.secret-field { position: relative; }
.secret-field input { padding-right: 54px; }
.icon-button {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 11px;
  color: #66817b;
  background: transparent;
  cursor: pointer;
}
.icon-button:hover { color: var(--mint-dark); background: var(--mint-soft); }
.icon-button svg { width: 21px; height: 21px; fill: currentColor; }

.save-option { display: flex; align-items: flex-start; gap: 12px; margin: 4px 0 24px; cursor: pointer; }
.save-option input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark { position: relative; width: 22px; height: 22px; flex: 0 0 auto; border: 1.5px solid #aecbc3; border-radius: 7px; background: #fff; transition: .18s; }
.save-option input:checked + .checkmark { border-color: var(--mint); background: var(--mint); }
.save-option input:checked + .checkmark::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.save-option strong, .save-option small { display: block; }
.save-option strong { margin-bottom: 3px; font-size: 14px; }
.save-option small { color: var(--muted); font-size: 12px; line-height: 1.45; }

.primary-button {
  display: flex;
  width: 100%;
  height: 56px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, #16b88f, #078168);
  box-shadow: 0 13px 28px rgba(9, 137, 107, .24);
  cursor: pointer;
  font-weight: 800;
  transition: transform .18s, box-shadow .18s;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(9, 137, 107, .29); }
.primary-button:active { transform: translateY(1px); }
.primary-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.error-message { min-height: 20px; margin: 13px 0 0; color: var(--danger); font-size: 13px; text-align: center; }

.code-panel { display: grid; place-items: center; overflow: hidden; background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(232,248,243,.9)); }
.code-placeholder { max-width: 370px; text-align: center; }
.placeholder-icon { display: grid; width: 76px; height: 76px; margin: 0 auto 22px; place-items: center; border-radius: 24px; color: var(--mint-dark); background: #e1f5ef; }
.placeholder-icon svg { width: 35px; height: 35px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.code-placeholder h2 { margin-bottom: 9px; }
.code-placeholder p { margin: 0; color: var(--muted); line-height: 1.7; }
.hidden { display: none !important; }

.code-result { width: 100%; }
.result-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 30px; color: var(--muted); font-size: 13px; }
.live-dot { display: inline-flex; align-items: center; gap: 8px; color: var(--mint-dark); font-weight: 800; }
.live-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(19,173,136,.13); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(19,173,136,0); } }

.code-button { display: block; width: 100%; border: 0; padding: 18px 10px 21px; color: var(--ink); background: transparent; cursor: pointer; text-align: center; }
.code-button span { display: block; font-variant-numeric: tabular-nums; font-size: clamp(54px, 8vw, 82px); font-weight: 820; letter-spacing: .12em; line-height: 1.1; }
.code-button small { display: inline-block; margin-top: 12px; padding: 7px 12px; border-radius: 999px; color: var(--mint-dark); background: var(--mint-soft); font-size: 12px; font-weight: 750; }

.timer-block { margin-top: 24px; padding: 20px; border: 1px solid #d9ebe6; border-radius: 19px; background: rgba(255,255,255,.68); }
.timer-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.timer-row strong { color: var(--ink); }
.timer-row b { font-size: 18px; font-variant-numeric: tabular-nums; }
.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: #dcece8; }
.progress-bar { width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0e9272, #28c99d); transform-origin: left; transition: transform .16s linear, background .2s; }
.progress-bar.warning { background: linear-gradient(90deg, #df8b3c, #f0b14d); }
.timer-block p { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.result-meta { display: flex; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.result-meta span { padding: 6px 10px; border: 1px solid #d7e8e3; border-radius: 999px; color: #5d746e; background: rgba(255,255,255,.7); font-size: 11px; font-weight: 700; }

.history-panel { margin-top: 22px; padding: 30px; }
.history-heading { align-items: center; }
.history-list { display: grid; gap: 11px; }
.history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 17px; background: rgba(251,254,253,.9); transition: border-color .18s, transform .18s; }
.history-item:hover { border-color: #add9cc; transform: translateY(-1px); }
.history-name { margin: 0 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 800; }
.history-meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.history-actions { display: flex; gap: 8px; }
.use-button, .delete-button { height: 38px; border-radius: 11px; padding: 0 14px; cursor: pointer; font-size: 13px; font-weight: 750; }
.use-button { border: 1px solid #b8dfd4; color: var(--mint-dark); background: var(--mint-soft); }
.delete-button { width: 38px; border: 1px solid #ead4d7; padding: 0; color: var(--danger); background: #fff7f8; }
.empty-history { padding: 30px 10px 20px; color: var(--muted); text-align: center; }
.empty-history span, .empty-history small { display: block; }
.empty-history span { margin-bottom: 7px; color: var(--ink); font-weight: 750; }

footer { display: flex; justify-content: center; gap: 8px; padding: 28px 0 4px; color: #7b8f8a; font-size: 12px; text-align: center; }

.visitor-widget { position: fixed; right: 18px; bottom: 18px; z-index: 1000; min-width: 238px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.85); border-radius: 17px; background: rgba(255,255,255,.94); box-shadow: 0 14px 38px rgba(15,23,42,.18); }
.visitor-title { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; color: #506660; font-size: 12px; font-weight: 750; }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.14); }
.visitor-metrics { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 12px; align-items: center; }
.visitor-line { height: 31px; background: #dce8e4; }
.visitor-metric span { display: block; color: #71847f; font-size: 11px; }
.visitor-metric strong { display: block; margin-top: 2px; color: var(--mint-dark); font-size: 21px; line-height: 1.2; }
.visitor-metric b { font-variant-numeric: tabular-nums; }
.visitor-loading { opacity: .62; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 26px; max-width: calc(100% - 32px); transform: translate(-50%, 18px); padding: 12px 17px; border-radius: 13px; color: #fff; background: rgba(14, 50, 44, .94); box-shadow: 0 13px 35px rgba(18,60,52,.2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; font-size: 13px; font-weight: 750; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .page-shell { padding-top: 40px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .workspace { grid-template-columns: 1fr; }
  .generator-panel, .code-panel { min-height: auto; }
  .code-panel { min-height: 470px; }
}

@media (max-width: 540px) {
  .page-shell { width: min(100% - 22px, 1120px); padding-top: 27px; }
  .hero { margin-bottom: 23px; }
  .hero-copy { font-size: 14px; line-height: 1.6; }
  .panel { border-radius: 22px; }
  .generator-panel, .code-panel, .history-panel { padding: 22px; }
  .section-heading { margin-bottom: 22px; }
  .code-button span { font-size: 48px; letter-spacing: .08em; }
  .history-item { grid-template-columns: 1fr; }
  .history-actions { justify-content: flex-end; }
  footer { flex-direction: column; gap: 3px; }
  footer span:nth-child(2) { display: none; }
  .visitor-widget { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
