/* SecretLink — single stylesheet. No external fonts, images or imports. */

:root {
  color-scheme: light;
  --bg: #f3f6f4;
  --bg-glow: rgba(16, 185, 129, 0.12);
  --surface: #ffffff;
  --surface-2: #f6f9f7;
  --border: #e1e8e4;
  --border-strong: #cdd8d2;
  --text: #0e1a15;
  --muted: #5a6a63;
  --accent: #059669;
  --accent-hover: #047857;
  --accent-text: #ffffff;
  --accent-soft: rgba(5, 150, 105, 0.1);
  --accent-ring: rgba(16, 185, 129, 0.35);
  --danger: #c62828;
  --danger-soft: rgba(198, 40, 40, 0.08);
  --warning-bg: #fff7e0;
  --warning-border: #f2dfa6;
  --warning-text: #7a5300;
  --success-bg: #e8f6ef;
  --success-border: #bfe6d2;
  --success-text: #0b5e40;
  --shadow: 0 1px 2px rgba(14, 26, 21, 0.04), 0 12px 32px -12px rgba(14, 26, 21, 0.14);
  --radius: 18px;
  --radius-sm: 11px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f0d;
  --bg-glow: rgba(16, 185, 129, 0.10);
  --surface: #111916;
  --surface-2: #0d1512;
  --border: #1e2a25;
  --border-strong: #2a3a33;
  --text: #e7efeb;
  --muted: #92a39b;
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-text: #04241a;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --accent-ring: rgba(52, 211, 153, 0.35);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.1);
  --warning-bg: #231c0c;
  --warning-border: #4a3a14;
  --warning-text: #f3c969;
  --success-bg: #0f2219;
  --success-border: #1c3f2f;
  --success-text: #7fe0b6;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 520px at 50% -180px, var(--bg-glow), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- development banner ---------- */
.dev-banner {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-bottom: 1px solid var(--warning-border);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
}

/* ---------- top bar ---------- */
.topbar {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 20px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
}
.brand-mark { color: var(--accent); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.brand-accent { color: var(--accent); }
.brand-tagline { font-size: 12px; color: var(--muted); letter-spacing: 0.01em; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ---------- layout ---------- */
.shell {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 20px 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}

.title {
  margin: 0 0 18px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.title:focus { outline: none; }

.lead { margin: -6px 0 20px; color: var(--muted); font-size: 16px; }
.muted { color: var(--muted); margin: -6px 0 16px; }
.small { font-size: 13px; }

.footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 20px 26px;
}

/* ---------- create form ---------- */
.secret-input {
  display: block;
  width: 100%;
  min-height: 176px;
  resize: vertical;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.secret-input::placeholder { color: var(--muted); opacity: .85; font-family: var(--font); }
.secret-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
  background: var(--surface);
}

.field-meta { display: flex; justify-content: flex-end; margin: 8px 2px 18px; }
.counter { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.is-over { color: var(--danger); font-weight: 600; }

.facts {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.facts li {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.facts strong { font-size: 16px; font-weight: 700; color: var(--text); }
.facts span { font-size: 12px; color: var(--muted); }

.assurance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.assurance svg { color: var(--accent); flex: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, opacity .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: transparent; color: var(--danger); border-color: currentColor; }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }

.btn:focus-visible, .icon-btn:focus-visible, .brand:focus-visible, .link-field:focus-visible, .secret-output:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }

/* ---------- messages ---------- */
.alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  font-weight: 550;
}

.notice {
  margin-top: 18px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 14px;
}
.notice-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.notice-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.notice + .small { margin: 12px 0 0; }

.copy-status { min-height: 20px; margin: 10px 0 0; font-size: 13px; color: var(--accent); font-weight: 600; text-align: center; }
.copy-status:empty { margin: 0; min-height: 0; }

.status-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: grid; place-items: center;
  margin-bottom: 16px;
}
.status-success, .status-accent { background: var(--accent-soft); color: var(--accent); }
.status-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.status-danger { background: var(--danger-soft); color: var(--danger); }
.status-warning { background: var(--warning-bg); color: var(--warning-text); }

/* ---------- created link ---------- */
.link-field {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  text-overflow: ellipsis;
}
#expires { margin: 8px 2px 16px; }

/* ---------- revealed secret ---------- */
.revealed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.revealed-head .title { margin: 0; }

.timer {
  flex: none;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.timer.is-ending { background: var(--warning-bg); color: var(--warning-text); }

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 18px;
}
.progress-fill {
  --progress: 1;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(var(--progress));
  transition: transform .25s linear;
}
.progress-fill.is-ending { background: var(--warning-text); }

.secret-output {
  margin: 0 0 16px;
  padding: 16px;
  min-height: 96px;
  max-height: 46vh;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ---------- small screens ---------- */
/* ---------- V1.1: options, keys, management, security center ---------- */
.footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { color: var(--accent); }

.facts-options li { justify-content: center; align-items: center; }
.fact-select {
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 3px 4px;
  max-width: 100%;
  cursor: pointer;
}
.fact-select:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 1px; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: -8px 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 14px;
  cursor: pointer;
}
.check input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.check input:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.check-hint { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }

.field-label { display: block; margin: 14px 2px 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.copy-row .btn { white-space: nowrap; }
.field-note { margin: 8px 2px 0; }
.notice-tight { margin-top: 10px; }
.manage-block { margin-top: 4px; }
#create-another { margin-top: 18px; }
#access-key-group { margin-bottom: 16px; }

.status-list { margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.status-list > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 14px; background: var(--surface-2); }
.status-list > div + div { border-top: 1px solid var(--border); }
.status-list > div[hidden] { display: none; }
.status-list dt { color: var(--muted); font-size: 14px; }
.status-list dd { margin: 0; font-size: 14px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 3px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700; }
.badge-available { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.badge-revealed { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.badge-revoked { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.status-text { margin: 0 2px 16px; }
.confirm p { margin: 0 0 8px; }
.confirm .actions { margin-top: 10px; }

.prose h2 { margin: 22px 0 6px; font-size: 17px; letter-spacing: -0.01em; }
.prose p, .prose li { font-size: 15px; line-height: 1.55; }
.prose p { margin: 0 0 8px; }
.prose ul { margin: 0 0 8px; padding-left: 20px; }
.prose code { font-family: var(--mono); font-size: .92em; padding: 0 4px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); }

@media (max-width: 520px) {
  .copy-row { grid-template-columns: 1fr; }
  .status-list > div { flex-direction: column; align-items: flex-start; gap: 2px; }
  .status-list dd { text-align: left; }
}

@media (max-width: 520px) {
  .topbar { padding: 16px 16px 4px; }
  .shell { padding: 12px 12px 20px; }
  .card { padding: 22px 18px; border-radius: 16px; }
  .title { font-size: 22px; }
  .facts { gap: 8px; }
  .facts li { padding: 10px 6px; }
  .facts strong { font-size: 15px; }
  .facts span { font-size: 11px; }
  .actions { grid-template-columns: 1fr; }
  .secret-input { min-height: 150px; }
}

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

/* ---------- V1.2: Secure Files (compact block on the existing design) ---------- */
.file-drop {
  margin: -6px 0 18px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color .15s ease, background .15s ease;
}
.file-drop.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.file-drop-line { margin: 0; font-size: 14px; color: var(--text); }
.file-drop-hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.link-button {
  padding: 0; border: 0; background: none; font: inherit; color: var(--accent);
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.link-button:hover { color: var(--accent-hover); }
.link-button:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; border-radius: 4px; }
.file-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.file-item {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
}
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-size { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-item .btn { padding: 6px 12px; font-size: 13px; }
.file-total { margin: 8px 2px 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.file-total.is-over { color: var(--danger); font-weight: 600; }
.files-block { margin: 0 0 16px; }
.files-block .file-list { margin-top: 0; }
