:root {
  color-scheme: light dark;
  --page: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --secondary: #5f5f64;
  --tertiary: #8e8e93;
  --placeholder: #59595f;
  --line: rgba(60, 60, 67, 0.14);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-pressed: rgba(118, 118, 128, 0.20);
  --blue: #006bd6;
  --button-blue: #006bd6;
  --button-blue-pressed: #0054ad;
  --red: #b42318;
  --danger: #b42318;
  --danger-pressed: #8f1b13;
  --green: #237a3b;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: var(--sans);
  letter-spacing: 0;
}

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

button {
  appearance: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

.nav-shell {
  width: min(1120px, 100%);
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 12px 24px;
}

.brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 20px;
  font-weight: 750;
  white-space: nowrap;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.22);
}

.brand-accent {
  color: var(--blue);
}

.top-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.top-nav button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--secondary);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 620;
  line-height: 1.2;
  white-space: nowrap;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.top-nav button:hover:not(:disabled),
.top-nav button:focus-visible {
  color: var(--text);
  background: var(--fill);
}

.top-nav button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.top-nav button:active:not(:disabled) {
  background: var(--fill-pressed);
}

.top-nav button:disabled {
  color: var(--tertiary);
  cursor: default;
  opacity: 0.58;
}

.page-content {
  width: 100%;
  display: grid;
  place-items: start center;
  padding: max(48px, 8vh) 16px 24px;
}

.card {
  position: relative;
  width: min(360px, 100%);
  min-height: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
}

.header {
  min-height: 34px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.header-copy {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 680;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 3px 0 0;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.secret-input {
  width: 100%;
  height: 44px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--text);
  background: var(--fill);
  outline: none;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.secret-input:focus {
  border-color: var(--blue);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(0, 107, 214, 0.16);
}

.secret-input::placeholder {
  color: var(--placeholder);
  font-family: var(--sans);
  font-weight: 400;
}

.button {
  height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 15px;
  color: #ffffff;
  background: var(--button-blue);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition: transform 100ms ease, background-color 100ms ease, opacity 100ms ease;
}

.button:active:not(:disabled) {
  transform: scale(0.98);
  background: var(--button-blue-pressed);
}

.button:disabled {
  color: var(--tertiary);
  background: var(--fill);
  cursor: default;
}

.button.secondary {
  color: var(--text);
  background: var(--fill);
}

.button.secondary:active:not(:disabled) {
  background: var(--fill-pressed);
}

.button:focus-visible,
.cancel-button:focus-visible,
.code-value:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.button.copied {
  background: var(--green);
}

.button.copy-error {
  background: var(--danger);
}

.hint,
.error {
  margin: 9px 2px 0;
  font-size: 12px;
  line-height: 1.4;
}

.hint {
  color: var(--secondary);
}

.error {
  color: var(--red);
}

.error:empty {
  display: none;
}

.code-value {
  width: 100%;
  display: block;
  padding: 6px 0 10px;
  color: var(--text);
  text-align: center;
  font-family: var(--mono);
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  margin: 2px 4px 15px;
}

.track {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--fill);
}

.progress {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transform: scaleX(1);
  transform-origin: left center;
  will-change: transform;
}

.seconds {
  color: var(--secondary);
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timer.expiring .progress {
  background: var(--red);
}

.timer.expiring .seconds {
  color: var(--red);
  font-weight: 700;
}

.actions {
  display: grid;
  gap: 8px;
}

.actions .button {
  width: 100%;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.32);
}

.dialog {
  width: min(320px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--card);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
}

.dialog h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.dialog p {
  margin: 8px 0 16px;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

.dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dialog-actions.single {
  grid-template-columns: 1fr;
}

.button.danger {
  color: #ffffff;
  background: var(--danger);
}

.button.danger:active:not(:disabled) {
  background: var(--danger-pressed);
}

.cancel-button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  padding: 0 4px;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.delete-secret-button {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 1px solid color-mix(in srgb, var(--red) 32%, transparent);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--red);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 620;
}

.delete-secret-button:hover,
.delete-secret-button:focus-visible {
  background: color-mix(in srgb, var(--red) 8%, transparent);
}

.delete-secret-button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.delete-secret-button:active {
  background: color-mix(in srgb, var(--red) 14%, transparent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 9px 13px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(29, 29, 31, 0.88);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

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

.clipboard-helper {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

@media (max-width: 760px) {
  .nav-shell {
    min-height: 64px;
    gap: 8px;
    padding: 8px 12px;
  }

  .brand {
    gap: 8px;
    font-size: 18px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .top-nav {
    width: auto;
    flex: 0 0 auto;
    gap: 4px;
  }

  .top-nav button {
    width: auto;
    min-height: 44px;
    padding-inline: 8px;
    font-size: 13px;
  }

  .page-content {
    padding-top: 32px;
  }
}

@media (max-width: 340px) {
  .page-content {
    padding: 28px 10px 16px;
  }

  .card {
    padding: 16px;
  }

  .code-value {
    font-size: 38px;
  }

  .button {
    padding-inline: 10px;
    font-size: 13px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #000000;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --secondary: #c1c1c6;
    --tertiary: #8e8e93;
    --placeholder: #c1c1c6;
    --line: rgba(255, 255, 255, 0.12);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-pressed: rgba(118, 118, 128, 0.34);
    --blue: #409cff;
    --button-blue: #006bd6;
    --button-blue-pressed: #0054ad;
    --red: #ff8a80;
  }

  .card {
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
