/* ===== 2FA page (extends style.css tokens) ===== */
.main-stack { max-width: 1080px; }

.secret-field {
  position: relative; display: flex; align-items: flex-start; min-width: 0;
  min-height: 56px; border-radius: var(--shape-l); background: var(--surface-c-highest);
  transition: box-shadow .2s var(--ease), background-color .2s;
}
.secret-field:focus-within { box-shadow: inset 0 0 0 2px var(--primary); background: var(--surface-c-lowest); }
.secret-field .field-leading { height: 56px; }
.secret-field .field-trailing { height: 56px; }
.secret-field textarea {
  flex: 1; min-width: 0; display: block; resize: none; overflow: hidden;
  min-height: 56px; max-height: 260px; padding: 17px 4px; border: 0; outline: 0; background: transparent;
  color: var(--on-surface); font: 15px/22px var(--mono); letter-spacing: .02em;
  white-space: pre; overflow-x: auto;
}
.secret-field textarea::placeholder { color: var(--on-surface-variant); opacity: .8; font-family: var(--font); letter-spacing: .01em; }
.secret-field.masked textarea { -webkit-text-security: disc; }
.secret-field.masked textarea:not(:placeholder-shown) { color: transparent; text-shadow: 0 0 9px color-mix(in srgb, var(--on-surface) 70%, transparent); }
@supports (-webkit-text-security: disc) {
  .secret-field.masked textarea:not(:placeholder-shown) { color: var(--on-surface); text-shadow: none; }
}

.codes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.codes:empty { display: none; }
.codes-empty { display: grid; justify-items: center; gap: 16px; padding: 40px 24px; border-radius: var(--shape-xl); background: var(--surface-c-low); color: var(--on-surface-variant); text-align: center; }
.codes-empty .empty-art { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 30px; background: var(--primary-container); color: var(--on-primary-container); }
.codes-empty .empty-art .svg-icon { width: 40px; height: 40px; }

.code-card {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px;
  width: 100%; min-width: 0; padding: 20px 20px 18px 24px; border: 0; border-radius: var(--shape-xl);
  background: var(--surface-c-low); color: var(--on-surface); text-align: left;
  transition: border-radius .3s var(--ease), background-color .2s, transform .2s var(--ease);
  animation: rise .35s var(--ease) both;
}
.code-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: currentColor; opacity: 0; transition: opacity .2s; }
.code-card:hover::before { opacity: .06; }
.code-card:active { border-radius: var(--shape-l); transform: scale(.99); }
.code-card.copied { background: var(--primary-container); color: var(--on-primary-container); }
.code-card.invalid { cursor: default; background: var(--error-container); color: var(--on-error-container); }
.code-card.invalid::before { display: none; }

.code-label { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; font-weight: 500; color: var(--on-surface-variant); }
.code-card.copied .code-label, .code-card.invalid .code-label { color: inherit; opacity: .85; }
.code-label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-label .svg-icon { width: 16px; height: 16px; flex: none; }

.code-value {
  min-width: 0; font-size: clamp(34px, 6vw, 44px); line-height: 1.15; font-weight: 500;
  letter-spacing: .04em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--primary);
}
.code-card.copied .code-value { color: inherit; }
.code-value .gap { display: inline-block; width: .35em; }
.code-card.ending .code-value { color: var(--error); animation: pulse 1s ease-in-out infinite; }
.code-error { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }

.code-next { grid-column: 1; font-size: 12px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.code-next b { font-weight: 500; letter-spacing: .04em; }
.code-card.copied .code-next { color: inherit; opacity: .8; }

.ring { grid-column: 2; grid-row: 2 / span 2; position: relative; width: 52px; height: 52px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--surface-c-highest); }
.ring .bar { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s; }
.code-card.ending .ring .bar { stroke: var(--error); }
.code-card.copied .ring .track { stroke: color-mix(in srgb, currentColor 18%, transparent); }
.code-card.copied .ring .bar { stroke: currentColor; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }

.copy-hint { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--on-surface-variant); opacity: 0; transition: opacity .2s; }
.copy-hint .svg-icon { width: 18px; height: 18px; }
.code-card:hover .copy-hint, .code-card:focus-visible .copy-hint { opacity: 1; }
.code-card.copied .copy-hint { opacity: 1; color: inherit; }

.snackbar {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); min-height: 48px; padding: 12px 20px;
  border-radius: var(--shape-s); background: var(--on-surface); color: var(--surface);
  font-size: 14px; box-shadow: var(--elev-2); animation: rise .25s var(--ease);
}
.snackbar .svg-icon { width: 20px; height: 20px; }

@media (max-width: 760px) {
  .codes { grid-template-columns: 1fr; }
  .code-card { padding: 18px 16px 16px 20px; }
  .copy-hint { display: none; }
}
