:root {
  --bg-page: #f7f6f2;
  --bg-surface: #ffffff;
  --bg-subtle: #eeecea;
  --bg-hover: #e4e1db;
  --border-weak: rgba(0, 0, 0, 0.1);
  --border-mid: rgba(0, 0, 0, 0.16);
  --border-strong: rgba(0, 0, 0, 0.24);
  --text-primary: #0d0d0d;
  --text-secondary: #3a3a3a;
  --text-tertiary: #767676;
  --brand: #2c5cff;
  --brand-light: #eef1ff;
  --brand-mid: #6e8fff;
  --brand-border: rgba(44, 92, 255, 0.35);
  --brand-text: #1a3dcc;
  --teal: #18a76a;
  --teal-light: #eaf8f1;
  --teal-border: rgba(24, 167, 106, 0.28);
  --teal-text: #108552;
  --purple: #5b6fd6;
  --purple-light: #eef1ff;
  --purple-border: rgba(44, 92, 255, 0.22);
  --purple-text: #1a3dcc;
  --red: #e24b4a;
  --red-light: #fcebeb;
  --red-border: rgba(226, 75, 74, 0.3);
  --red-text: #a32d2d;
  --accent: #2c5cff;
  --accent-light: #eef1ff;
  --accent-border: rgba(44, 92, 255, 0.35);
  --accent-text: #1a3dcc;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 22px;
  --r-pill: 999px;
  --font: -apple-system, "PingFang SC", BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Microsoft YaHei UI", "PingFang SC", monospace;
  --tr: 0.15s ease;
  --shadow-card: 0 16px 38px rgba(27, 35, 56, 0.07);
  --shadow-btn: 0 10px 24px rgba(44, 92, 255, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #111218;
    --bg-surface: #1a1c24;
    --bg-subtle: #22252f;
    --bg-hover: #2a2e3a;
    --border-weak: rgba(255, 255, 255, 0.08);
    --border-mid: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.22);
    --text-primary: #f2f3f7;
    --text-secondary: #b8bcc8;
    --text-tertiary: #7f8596;
    --brand: #5b7fff;
    --brand-light: #1a254d;
    --brand-mid: #8aa4ff;
    --brand-border: rgba(91, 127, 255, 0.35);
    --brand-text: #a8bcff;
    --teal-light: #0d2e22;
    --teal-border: rgba(93, 202, 165, 0.25);
    --teal-text: #7dffc9;
    --purple-light: #1a254d;
    --purple-border: rgba(91, 127, 255, 0.25);
    --purple-text: #a8bcff;
    --red-light: #501313;
    --red-border: rgba(240, 149, 149, 0.25);
    --red-text: #f09595;
    --shadow-card: 0 16px 38px rgba(0, 0, 0, 0.28);
    --shadow-btn: 0 10px 24px rgba(44, 92, 255, 0.22);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

svg {
  flex-shrink: 0;
}

[hidden] {
  display: none !important;
}

.page {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 0 20px 64px;
  overflow-x: clip;
}

.header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 32px 0 28px;
  border-bottom: 0.5px solid var(--border-weak);
  margin-bottom: 28px;
}

.header-logo {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0.5px solid var(--brand-border);
  border-radius: var(--r-md);
  background: var(--brand-light);
}

.header-logo svg {
  width: 22px;
  height: 22px;
  fill: var(--brand);
}

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

.header-text h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
}

.header-text p {
  margin: 1px 0 0;
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
}

.status-pill {
  margin-left: auto;
  flex-shrink: 0;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-pill);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  white-space: nowrap;
}

.status-pill.ready {
  border-color: var(--teal-border);
  background: var(--teal-light);
  color: var(--teal-text);
}

.status-pill.bad {
  border-color: var(--red-border);
  background: var(--red-light);
  color: var(--red-text);
}

.auth-user-badge {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-logout {
  appearance: none;
}

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  padding: 3px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  max-width: 100%;
}

.tab-btn {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 7px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 12px;
  transition: all var(--tr);
  white-space: nowrap;
}

.tab-btn:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tab-btn.active {
  border: 0.5px solid var(--border-weak);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tab-btn svg {
  width: 15px;
  height: 15px;
  opacity: 0.75;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.card {
  width: 100%;
  margin: 0 0 16px;
  padding: 28px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-xl);
  background: var(--bg-surface);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 0.5px solid var(--border-weak);
}

.card-header > :last-child {
  min-width: 0;
}

.card-header-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
}

.card-header-icon svg {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
}

.card-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.card-subtitle {
  margin: 1px 0 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.drop-zone {
  position: relative;
  margin-bottom: 20px;
  border: 1px dashed var(--border-mid);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  cursor: pointer;
  padding: 32px 20px;
  text-align: center;
  transition: all var(--tr);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-light);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.drop-icon,
.drop-icon svg {
  width: 36px;
  height: 36px;
}

.drop-icon {
  margin: 0 auto 10px;
  color: var(--text-tertiary);
}

.drop-main {
  margin-bottom: 4px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.drop-sub {
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.file-bar {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  border: 0.5px solid var(--teal-border);
  border-radius: var(--r-md);
  background: var(--teal-light);
  padding: 10px 14px;
}

.file-bar.show {
  display: flex;
}

.file-bar-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--teal-text);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
}

.file-bar-meta {
  min-width: 0;
  flex: 1;
}

.file-bar-name {
  overflow: hidden;
  color: var(--teal-text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-bar-size {
  margin-top: 1px;
  color: var(--text-secondary);
  font-size: 11px;
}

.file-bar-clear {
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 18px;
  line-height: 1;
  padding: 4px 7px;
  transition: all var(--tr);
}

.file-bar-clear:hover {
  background: var(--red-light);
  color: var(--red);
}

.flash-parts-panel {
  display: grid;
  gap: 10px;
  margin: -8px 0 20px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  padding: 12px;
}

.flash-parts-panel[hidden] {
  display: none;
}

.flash-parts-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.flash-parts-head small {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 400;
}

.flash-parts-list {
  display: grid;
  gap: 8px;
}

.flash-part-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 150px) auto;
  align-items: center;
  gap: 10px;
}

.flash-part-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flash-part-offset {
  width: 100%;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 10px;
}

.flash-part-row small {
  color: var(--text-tertiary);
  font-size: 11px;
  white-space: nowrap;
}

.chip-params-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin-bottom: 18px;
}

.chip-params-panel .field-hint {
  display: block;
  margin-top: 6px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.45;
}

.expert-params {
  margin-bottom: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: var(--bg-surface);
}

.expert-params > summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  list-style: none;
}

.expert-params > summary::-webkit-details-marker {
  display: none;
}

.expert-params[open] > summary {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.expert-params .field {
  margin: 14px;
}

.fw-tag--clock {
  background: rgba(24, 167, 106, 0.12);
  color: #12875a;
}

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

.field,
.form-section {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field span,
.form-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  outline: none;
  background: var(--bg-subtle);
  color: var(--text-primary);
  padding: 10px 12px;
  transition: all var(--tr);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-border);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.exp-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exp-btn {
  min-width: 64px;
  flex: 1;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  text-align: center;
  transition: all var(--tr);
}

.exp-btn:hover {
  border-color: var(--border-mid);
  color: var(--text-primary);
}

.exp-btn.selected {
  border-color: var(--brand-border);
  background: var(--brand-light);
  color: var(--brand-text);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 12px 14px;
  transition: background var(--tr);
}

.toggle-row:hover {
  background: var(--bg-hover);
}

.toggle-copy {
  flex: 1;
}

.toggle-name {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

.toggle-desc {
  margin-top: 2px;
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 11px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--border-mid);
  cursor: pointer;
  transition: background var(--tr);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: left var(--tr);
}

.switch input:checked + .switch-track {
  background: var(--brand);
}

.switch input:checked + .switch-track::after {
  left: 23px;
}

.switch input:disabled + .switch-track {
  background: var(--border-weak);
  cursor: not-allowed;
  opacity: 0.65;
}

.progress-wrap {
  display: none;
  margin-bottom: 18px;
}

.progress-wrap.show {
  display: block;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand);
  transition: width 0.1s linear;
}

.upload-btn,
.modal-start-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 16px;
  transition: all var(--tr);
}

.upload-btn:hover:not(:disabled),
.modal-start-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.upload-btn:active:not(:disabled),
.modal-start-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.upload-btn svg,
.modal-start-btn svg {
  width: 16px;
  height: 16px;
}

.state {
  margin-top: 14px;
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
}

.state.muted {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.state.good {
  border: 0.5px solid var(--teal-border);
  background: var(--teal-light);
  color: var(--teal-text);
}

.state.bad {
  border: 0.5px solid var(--red-border);
  background: var(--red-light);
  color: var(--red-text);
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 14px 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--teal-border);
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.08);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast--success {
  border-color: rgba(20, 160, 111, 0.22);
}

.toast--error {
  border-color: rgba(220, 38, 38, 0.22);
}

.toast--error .toast-icon {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.toast-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--teal-light);
  color: var(--teal-text);
}

.toast-icon svg {
  width: 18px;
  height: 18px;
}

.toast-body {
  min-width: 0;
  padding-top: 2px;
}

.toast-title {
  display: block;
  margin-bottom: 4px;
  color: #111827 !important;
  font-size: 14px;
  font-weight: 700;
}

.toast-message {
  display: block;
  color: #1a1a1a;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
}

.toast-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.toast-close:hover {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

.result-wrap {
  display: none;
  text-align: center;
  padding: 18px 0 4px;
}

.result-wrap.show {
  display: block;
}

.result-eyebrow {
  margin-bottom: 12px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.code-block {
  position: relative;
  margin-bottom: 14px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  padding: 22px 16px;
}

.code-value {
  color: var(--brand);
  font-family: var(--mono);
  font-size: clamp(34px, 9vw, 52px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 10px;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  transition: all var(--tr);
}

.code-copy-btn:hover,
.code-copy-btn.copied {
  border-color: var(--teal-border);
  background: var(--teal-light);
  color: var(--teal-text);
}

.code-copy-btn svg {
  width: 13px;
  height: 13px;
}

.result-notice {
  margin-bottom: 14px;
  border: 0.5px solid var(--brand-border);
  border-radius: var(--r-md);
  background: var(--brand-light);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  padding: 10px 14px;
  text-align: left;
}

.result-notice strong {
  color: var(--brand-text);
}

.upload-again-btn {
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 7px 16px;
  transition: all var(--tr);
}

.upload-again-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.locker-wrap {
  position: relative;
  margin-bottom: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 12px 0 4px;
  text-align: center;
  cursor: text;
}

.locker-wrap:focus-within .locker-cell.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(44, 92, 255, 0.2);
}

.code-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  opacity: 0;
  padding: 0;
  cursor: text;
  background: transparent;
}

.locker-label {
  margin-bottom: 10px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.locker-cells {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.locker-cell {
  width: 40px;
  height: 50px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  transition: border-color var(--tr), box-shadow var(--tr), background var(--tr);
}

.locker-cell.filled {
  border-color: rgba(0, 0, 0, 0.12);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.locker-cell.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(44, 92, 255, 0.2);
}

.locker-cell.empty-dot {
  color: rgba(0, 0, 0, 0.18);
  font-size: 18px;
  line-height: 1;
}

.extract-card {
  padding: 24px 22px 22px;
}

.extract-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
}

.extract-header-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.extract-header-icon svg {
  width: 22px;
  height: 22px;
  color: var(--text-primary);
}

.extract-header-text {
  min-width: 0;
}

.extract-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.extract-subtitle {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.extract-entry {
  display: grid;
  gap: 18px;
}

@media (prefers-color-scheme: dark) {
  .locker-cell {
    border-color: var(--border-mid);
  }

  .locker-cell.filled {
    border-color: var(--border-strong);
  }

  .locker-cell.empty-dot {
    color: var(--border-strong);
  }

  .kb-key {
    border-color: var(--border-mid);
  }
}

.locker-wrap.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-7px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(5px);
  }
}

.kb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.kb-grid-hex {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.kb-grid-alnum {
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.kb-grid-alnum .kb-key {
  min-height: 42px;
  font-size: 14px;
}

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

.kb-action {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--tr), color var(--tr);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.kb-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.kb-action:active {
  transform: scale(0.98);
}

.kb-action.key-del:hover {
  background: var(--red-light);
  color: var(--red-text);
}

.kb-key {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  padding: 14px 8px;
  transition: border-color var(--tr), background var(--tr), transform 0.1s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.kb-key:hover {
  border-color: rgba(0, 0, 0, 0.14);
  background: var(--bg-hover);
}

.kb-key:active {
  border-color: rgba(0, 0, 0, 0.12);
  background: var(--bg-subtle);
  transform: scale(0.97);
}

.kb-key.key-del,
.kb-key.key-clr {
  display: none;
}

.profile-card {
  padding: 24px 22px 22px;
}

.profile-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-user-line {
  color: var(--text-secondary);
  font-size: 13px;
}

.profile-user-line strong {
  color: var(--text-primary);
  font-weight: 600;
}

.profile-refresh-btn {
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  transition: all var(--tr);
}

.profile-refresh-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.profile-empty {
  margin-top: 12px;
  border: 0.5px dashed var(--border-mid);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  padding: 18px 16px;
  text-align: center;
}

.profile-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}



.profile-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  padding: 16px;
}

.profile-item-main {
  min-width: 0;
  flex: 1;
}

.profile-item-title {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.profile-item-code {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.profile-item-code code {
  color: var(--brand-text);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
}

.profile-item-uploader {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.uploader-link {
  border: none;
  background: transparent;
  color: var(--brand-text);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.uploader-link:hover {
  color: var(--text-primary);
}

.profile-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.profile-item-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.profile-copy-btn,
.profile-edit-btn,
.profile-delete-btn {
  min-width: 84px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  transition: all var(--tr);
}

.profile-copy-btn:hover {
  border-color: var(--brand-border);
  color: var(--brand-text);
  background: var(--brand-light);
}

.profile-edit-btn {
  border-color: var(--accent-border);
  color: var(--accent-text);
  background: var(--accent-light);
}

.profile-edit-btn:hover {
  filter: brightness(0.98);
}

.profile-delete-btn {
  border-color: var(--red-border);
  color: var(--red-text);
  background: var(--red-light);
}

.profile-delete-btn:hover {
  filter: brightness(0.98);
}

.delete-box {
  width: min(460px, 100%);
}

.edit-box {
  width: min(480px, 100%);
}

.delete-confirm-text {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.delete-actions,
.edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.delete-cancel-btn,
.delete-confirm-btn,
.edit-cancel-btn,
.edit-submit-btn {
  min-height: 44px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--tr);
}

.delete-cancel-btn,
.edit-cancel-btn {
  border: 0.5px solid var(--border-mid);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.delete-cancel-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.delete-confirm-btn {
  border: 0.5px solid var(--red-border);
  background: var(--red);
  color: #fff;
}

.delete-confirm-btn:hover:not(:disabled) {
  filter: brightness(1.03);
}

.delete-confirm-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.edit-submit-btn {
  border: 0.5px solid var(--brand-border);
  background: var(--brand);
  color: #fff;
}

.edit-submit-btn:hover:not(:disabled) {
  filter: brightness(1.03);
}

.edit-submit-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.extract-error {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  border: 0.5px solid var(--red-border);
  border-radius: var(--r-md);
  background: var(--red-light);
  color: var(--red-text);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
}

.extract-error.show {
  display: flex;
}

.extract-error.loading {
  border-color: var(--border-weak);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.extract-error svg {
  width: 15px;
  height: 15px;
}

.fw-card {
  display: none;
  margin-top: 16px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-xl);
  background: var(--bg-surface);
  padding: 20px;
}

.fw-card.show {
  display: block;
}

.fw-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--border-weak);
}

.fw-file-badge {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0.5px solid var(--purple-border);
  border-radius: var(--r-md);
  background: var(--purple-light);
}

.fw-file-badge svg {
  width: 20px;
  height: 20px;
  color: var(--purple-text);
}

.fw-filename {
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.fw-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.profile-item-tags {
  margin-top: 8px;
}

.fw-tag {
  display: inline-block;
  border-radius: 3px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  text-transform: none;
}

.fw-tag--format {
  border: 0.5px solid var(--purple-border);
  background: var(--purple-light);
  color: var(--purple-text);
}

.fw-tag--chip {
  border: 0.5px solid rgba(14, 116, 144, 0.24);
  background: rgba(14, 116, 144, 0.08);
  color: #0e7490;
}

.fw-tag--featured {
  border: 0.5px solid rgba(245, 158, 11, 0.62);
  background: linear-gradient(135deg, #09090b 0%, #1f1a10 58%, #3a2a0b 100%);
  color: #f8d878;
  box-shadow: inset 0 0 0 1px rgba(255, 236, 179, 0.12), 0 1px 4px rgba(0, 0, 0, 0.18);
  font-weight: 800;
}

.fw-tag--expiry.fw-tag--permanent {
  border: 0.5px solid rgba(22, 101, 52, 0.24);
  background: rgba(22, 101, 52, 0.08);
  color: #166534;
}

.fw-tag--expiry.fw-tag--active {
  border: 0.5px solid rgba(180, 83, 9, 0.24);
  background: rgba(180, 83, 9, 0.08);
  color: #b45309;
  text-transform: none;
}

.fw-tag--expiry.fw-tag--expired {
  border: 0.5px solid rgba(185, 28, 28, 0.24);
  background: rgba(185, 28, 28, 0.08);
  color: #b91c1c;
}

.fw-ext-tag {
  display: inline-block;
  margin-top: 3px;
  border: 0.5px solid var(--purple-border);
  border-radius: 3px;
  background: var(--purple-light);
  color: var(--purple-text);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  text-transform: uppercase;
}

.fw-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.fw-meta-item {
  min-width: 0;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 10px 12px;
}

.fw-meta-key {
  margin-bottom: 4px;
  color: var(--text-tertiary);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.fw-meta-val {
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.fw-desc {
  display: none;
  margin-bottom: 14px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 10px 12px;
}

.fw-desc.show {
  display: block;
}

.flash-yes {
  color: var(--teal-text);
}

.flash-no {
  color: var(--text-tertiary);
}

.fw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fw-btn {
  font-family: var(--font);
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 7px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  transition: all var(--tr);
}

.fw-btn svg {
  width: 15px;
  height: 15px;
}

.fw-btn-dl {
  border: 0.5px solid var(--border-mid);
  background: transparent;
  color: var(--text-primary);
}

.fw-btn-dl:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.fw-btn-flash {
  border: 0.5px solid var(--teal-border);
  background: var(--teal-light);
  color: var(--teal-text);
}

.fw-btn-flash:hover:not(:disabled) {
  filter: brightness(0.96);
}

.fw-btn-flash:disabled {
  border-color: var(--border-mid);
  background: var(--bg-subtle);
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.72;
}

.browser-note {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--text-tertiary);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.5;
}

.browser-note svg {
  width: 12px;
  height: 12px;
}

.modal-faux {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
}

.modal-faux.show {
  display: flex;
}

.modal-box {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-xl);
  background: var(--bg-surface);
  padding: 24px;
  animation: modalPop 0.18s ease;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--border-weak);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
}

.modal-title svg {
  width: 18px;
  height: 18px;
  color: var(--teal);
}

.auth-box {
  width: min(420px, 100%);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 4px;
}

.auth-tab {
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
}

.auth-tab.active {
  border: 0.5px solid var(--border-weak);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.auth-form[hidden] {
  display: none;
}

.auth-extra {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.auth-link-btn {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 4px 0;
  transition: color var(--tr);
}

.auth-link-btn:hover {
  color: var(--brand-text);
}

.field.has-toggle {
  position: relative;
}

.input-with-toggle {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-toggle input {
  flex: 1;
  padding-right: 40px;
}

.toggle-password-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--tr);
}

.toggle-password-btn:hover {
  color: var(--text-secondary);
}

.toggle-password-btn svg {
  width: 18px;
  height: 18px;
}

.reset-box {
  width: min(400px, 100%);
}

.reset-form .field {
  margin-bottom: 14px;
}

.reset-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.reset-cancel-btn,
.reset-actions .upload-btn {
  min-width: 100px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  transition: all var(--tr);
}

.reset-actions .upload-btn {
  border-color: var(--brand-border);
  background: var(--brand);
  color: #fff;
}

.reset-cancel-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.reset-actions .upload-btn:hover:not(:disabled) {
  filter: brightness(1.03);
}

.modal-close {
  display: flex;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-tertiary);
  padding: 4px;
  transition: all var(--tr);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-desc {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}

.modal-steps {
  margin-bottom: 14px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 12px 14px;
}

.modal-steps + .notice {
  margin-bottom: 14px;
}

.flash-config {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.7fr);
  gap: 10px;
  margin-bottom: 14px;
}

.flash-select-field,
.flash-check {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 10px 12px;
}

.flash-select-field span,
.flash-check span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.flash-select-field select {
  height: 39px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 13px;
}

.flash-check {
  align-content: center;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  cursor: pointer;
}

.flash-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

.flash-progress-panel {
  margin-bottom: 14px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 12px 14px;
}

.flash-progress-head,
.flash-meter-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
}

.flash-progress-head {
  color: var(--text-primary);
  font-weight: 500;
}

.flash-progress-track,
.flash-meter-track {
  height: 5px;
  overflow: hidden;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-pill);
  background: var(--bg-surface);
}

.flash-progress-fill,
.flash-meter-fill {
  width: 0%;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand);
  transition: width 0.12s linear;
}

.flash-meter {
  margin-top: 11px;
}

.flash-meter-fill {
  background: var(--teal);
}

.modal-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 0;
}

.step-num {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  border: 0.5px solid var(--border-weak);
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
}

.terminal {
  height: 130px;
  overflow-y: auto;
  margin-bottom: 14px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: #1a1916;
  color: #9b9a96;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  padding: 12px 14px;
}

.t-line {
  display: block;
}

.t-ok {
  color: #5dcaa5;
}

.t-dim {
  color: #77736a;
}

.t-bad {
  color: #f09595;
}

.t-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: #9b9a96;
  vertical-align: middle;
  animation: cur 1s step-end infinite;
}

@keyframes cur {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.installer-mount {
  display: grid;
  gap: 10px;
}

.installer-mount esp-web-install-button {
  --esp-tools-button-color: var(--teal);
  --esp-tools-button-text-color: #fff;
  --esp-tools-button-border-radius: 10px;
}

.notice {
  border: 0.5px solid var(--brand-border);
  border-radius: var(--r-md);
  background: var(--brand-light);
  color: var(--brand-text);
  font-size: 13px;
  line-height: 1.55;
  padding: 10px 12px;
}

.footer {
  margin-top: 32px;
  border-top: 0.5px solid var(--border-weak);
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
  padding: 20px 0;
  text-align: center;
}

.key-page {
  width: min(560px, 100%);
}

.key-home-link {
  text-decoration: none;
}

.key-card {
  margin-top: 20px;
}

.key-result {
  padding-top: 22px;
  text-align: left;
}

.key-output {
  min-height: 96px;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 12px;
  resize: vertical;
  word-break: break-all;
}

.key-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.key-countdown {
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 12px;
}

@media (max-width: 560px) {


  .page {
    width: 100%;
    padding-inline: 14px;
  }

  .header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 8px;
    padding-top: 22px;
    padding-bottom: 20px;
    margin-bottom: 20px;
  }

  .header-logo {
    width: 36px;
    height: 36px;
  }

  .header-text h1 {
    font-size: 17px;
  }

  .header-text {
    flex: 1 1 calc(100% - 48px);
  }

  .header-text p {
    font-size: 10px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-pill {
    margin-left: 0;
    max-width: calc(50% - 4px);
    overflow: hidden;
    padding: 3px 8px;
    text-overflow: ellipsis;
  }

  .tabs {
    display: flex;
    gap: 2px;
    overflow: visible;
  }

  .tab-btn {
    flex: 1 1 0;
    line-height: 1.2;
    min-width: 0;
    gap: 4px;
    font-size: 12px;
    overflow: hidden;
    padding: 8px 4px;
    text-align: center;
    white-space: normal;
  }

  .tab-btn svg {
    width: 13px;
    height: 13px;
  }

  .card {
    padding: 18px 14px;
  }

  .card-header {
    align-items: flex-start;
  }

  .card-subtitle {
    overflow-wrap: anywhere;
  }

  .drop-zone {
    padding: 28px 12px;
  }

  .drop-main,
  .drop-sub {
    overflow-wrap: anywhere;
  }

  .field-grid,
  .chip-params-panel,
  .fw-meta,
  .flash-config {
    grid-template-columns: 1fr;
  }

  .flash-parts-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .flash-part-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .fw-card {
    padding: 16px 14px;
  }

  .fw-header {
    align-items: flex-start;
  }

  .fw-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .fw-btn {
    min-width: 0;
    width: 100%;
  }

  .modal-faux {
    align-items: stretch;
    padding: 12px;
  }

  .modal-box {
    max-height: calc(100dvh - 24px);
    padding: 18px 14px;
  }

  .modal-top,
  .flash-progress-head,
  .flash-meter-info {
    flex-wrap: wrap;
  }

  .profile-toolbar,
  .key-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-refresh-btn {
    width: 100%;
  }

  .locker-cell {
    width: 36px;
    height: 44px;
    font-size: 18px;
  }

  .extract-title {
    font-size: 17px;
  }

  .extract-subtitle {
    font-size: 12px;
  }

  .profile-item {
    flex-direction: column;
  }

  .profile-item-actions {
    flex-direction: row;
    width: 100%;
  }

  .profile-copy-btn,
  .profile-edit-btn,
  .profile-delete-btn {
    flex: 1;
  }

  .code-value {
    letter-spacing: 6px;
  }
}

@media (max-width: 360px) {
  .page {
    padding-inline: 12px;
  }

  .header {
    gap: 8px;
  }

  .header-logo {
    width: 34px;
    height: 34px;
  }

  .header-text {
    flex-basis: calc(100% - 42px);
  }

  .header-text h1 {
    font-size: 16px;
  }

  .status-pill {
    font-size: 10px;
    padding: 2px 7px;
  }

  .tab-btn {
    gap: 3px;
    padding-inline: 3px;
  }

  .tab-btn svg {
    width: 12px;
    height: 12px;
  }
}

/* Browse firmware list */
.browse-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.browse-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.browse-search-wrap {
  flex-shrink: 0;
}

.browse-search-input {
  height: 34px;
  padding: 6px 12px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  width: 220px;
  outline: none;
}

.browse-search-input:focus {
  border-color: var(--brand-border);
}

.browse-search-input::placeholder {
  color: var(--text-tertiary);
}

.browse-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.browse-filter select {
  height: 34px;
  padding: 6px 10px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
}

.browse-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.browse-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.browse-total {
  color: var(--text-secondary);
  font-size: 13px;
}

.browse-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.browse-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  padding: 16px;
  min-width: 0;
}

.browse-item-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
}

.browse-item-main {
  min-width: 0;
}

.browse-item-body {
  display: grid;
  grid-template-columns: minmax(260px, 480px) minmax(220px, 1fr);
  gap: 16px;
  align-items: stretch;
  min-width: 0;
}

.browse-item-body:not(:has(.browse-project-media)) {
  grid-template-columns: 1fr;
}

.browse-item-body--media-only {
  grid-template-columns: minmax(260px, 480px);
}

/* 广场卡片：媒体默认展示（单列，居中限宽） */
.browse-item-body--media {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  margin-top: 4px;
}

.browse-item-body--media .browse-project-media {
  width: 100%;
  max-width: 560px;
  margin: 0 !important;
}

.browse-item-body--media .project-carousel {
  max-width: 100%;
  margin: 0 !important;
}

.browse-item-body .browse-project-media {
  min-width: 0;
}

.browse-item-body--split .browse-project-media {
  display: flex;
  min-height: 100%;
  margin: 0 !important;
}

.browse-item-body--split .project-carousel {
  height: 100%;
  max-width: 100%;
  margin: 0 !important;
}

.browse-item-body--split .browse-item-description-panel {
  min-height: 100%;
}

.browse-item-description-panel {
  min-width: 0;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.38);
  padding: 14px 16px;
}

.browse-item-description-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.browse-item-title {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.browse-item-code {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.browse-item-code code {
  color: var(--brand-text);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
}

.browse-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.browse-item-uploader {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.browse-uploader-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--brand-text);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.browse-uploader-link:hover {
  opacity: 0.8;
}

.browse-item-desc {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.browse-item-main > .browse-item-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.browse-item-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

.browse-item-footer {
  min-width: 0;
}

.browse-item-votes {
  display: flex;
  align-items: center;
  gap: 4px;
}

.browse-vote-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all var(--tr);
}

.browse-vote-btn:hover {
  border-color: var(--brand-border);
  background: var(--brand-light);
}

.browse-like-btn.active {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

.browse-hate-btn.active {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.vote-count {
  font-variant-numeric: tabular-nums;
}

/* 热度统计条 */
.browse-item-heat {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.browse-item-heat-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 3px 9px;
  border: 0.5px solid var(--border-weak);
  border-radius: 999px;
  background: var(--bg-surface);
  font-size: 12px;
  line-height: 1.4;
}

.browse-item-heat-icon {
  font-size: 12px;
  filter: grayscale(0.2);
}

.browse-item-heat-num {
  color: var(--text-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.browse-item-heat-label {
  color: var(--text-tertiary);
  font-size: 11px;
}

/* 描述预览（折叠态，两行截断） */
.browse-item-desc-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 10px;
  color: var(--text-tertiary);
  font-size: 12.5px;
  line-height: 1.5;
}

/* 可折叠的详情区 */
.browse-item-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding-top: 4px;
  border-top: 0.5px dashed var(--border-weak);
  margin-top: 4px;
}

.browse-item-desc-full {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

/* 展开/收起按钮 */
.browse-item-toggle {
  justify-self: start;
  margin-top: 10px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--brand-text);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--tr);
}

.browse-item-toggle:hover {
  border-color: var(--brand-border);
  background: var(--accent-light);
}

/* 精选角标 */
.browse-item--featured {
  position: relative;
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.12);
}

.browse-item-featured-badge {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px 3px 8px;
  border-radius: 0 var(--r-lg) 0 var(--r-md);
  background: linear-gradient(135deg, #09090b 0%, #1f1a10 58%, #3a2a0b 100%);
  color: #f8d878;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 0 1px rgba(255, 236, 179, 0.12), 0 1px 4px rgba(0, 0, 0, 0.18);
}

.browse-item-featured-star {
  font-size: 12px;
}

@media (max-width: 720px) {
  .browse-item-featured-badge {
    font-size: 10px;
    padding: 2px 8px 2px 6px;
  }
  .browse-item-heat {
    gap: 5px;
  }
}

/* 视图切换按钮组 */
.browse-view-toggle {
  display: inline-flex;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-surface);
}

.browse-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  border-right: 0.5px solid var(--border-weak);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  cursor: pointer;
  transition: all var(--tr);
}

.browse-view-btn:last-child {
  border-right: none;
}

.browse-view-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.browse-view-btn.active {
  background: var(--accent-light);
  color: var(--accent-text);
}

.browse-view-btn svg {
  flex-shrink: 0;
}

/* 紧凑网格视图 */
.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 900px) {
  .browse-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

.browse-grid-card {
  display: flex;
  flex-direction: column;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr);
  outline: none;
}

.browse-grid-card:hover,
.browse-grid-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  border-color: var(--brand-border);
}

.browse-grid-card--featured {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.12);
}

.browse-grid-card--featured:hover {
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.18);
}

/* 缩略图 16:9 */
.browse-grid-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-subtle);
  overflow: hidden;
}

.browse-grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--tr);
}

.browse-grid-card:hover .browse-grid-thumb img {
  transform: scale(1.04);
}

/* 无图占位 */
.browse-grid-thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-subtle), var(--bg-surface));
}

.browse-grid-thumb-initial {
  font-size: 32px;
  font-weight: 700;
  color: var(--brand);
  opacity: 0.55;
  user-select: none;
}

/* 精选角标 */
.browse-grid-featured {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(244, 203, 105, 0.72);
  border-radius: 999px;
  background: linear-gradient(135deg, #080808 0%, #241a08 55%, #090909 100%);
  color: #f5d477;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 235, 166, 0.16);
  pointer-events: none;
}

.browse-grid-title {
  padding: 8px 10px 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browse-grid-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px 10px;
  margin-top: auto;
}

.browse-grid-chip {
  flex-shrink: 0;
  border: 0.5px solid rgba(14, 116, 144, 0.24);
  background: rgba(14, 116, 144, 0.08);
  color: #0e7490;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
}

.browse-grid-stats {
  color: var(--text-tertiary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.browse-grid-stats-sep {
  opacity: 0.5;
  margin: 0 2px;
}

@media (max-width: 720px) {
  .browse-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  .browse-grid-thumb-initial {
    font-size: 26px;
  }
  .browse-grid-title {
    font-size: 12px;
  }
}

/* 项目详情弹窗 */
.project-detail-box {
  width: min(720px, 100%);
  padding: 20px 22px;
}

.project-detail-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.project-detail-tags {
  margin-top: 0;
}

.project-detail-body .browse-project-media {
  margin: 0;
}

.project-detail-body .project-carousel {
  max-width: 100%;
  margin: 0;
}

.project-detail-section {
  border-top: 0.5px dashed var(--border-weak);
  padding-top: 14px;
}

.project-detail-section-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.project-detail-desc {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.project-detail-heat {
  margin-top: 0;
}

.project-detail-uploader {
  color: var(--text-tertiary);
  font-size: 12px;
}

.project-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 0.5px solid var(--border-weak);
  padding-top: 14px;
  margin-top: 4px;
}

.project-detail-code {
  color: var(--text-tertiary);
  font-size: 13px;
}

.project-detail-code code {
  color: var(--brand-text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background var(--tr);
}

.project-detail-code code:hover {
  background: var(--accent-light);
}

.project-detail-extract {
  padding: 9px 18px;
  font-size: 14px;
}

@media (max-width: 560px) {
  .project-detail-box {
    padding: 16px;
  }
  .project-detail-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .project-detail-extract {
    width: 100%;
  }
}

/* 表格视图 */
.browse-table-wrap {
  overflow-x: auto;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
}

.browse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 760px;
}

.browse-table thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 10px 12px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-surface);
  border-bottom: 0.5px solid var(--border-mid);
}

.browse-table tbody td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border-weak);
  color: var(--text-secondary);
  vertical-align: middle;
}

.browse-table tbody tr:last-child td {
  border-bottom: none;
}

.browse-table tbody tr {
  transition: background var(--tr);
}

.browse-table tbody tr:hover {
  background: var(--bg-surface);
}

.browse-table-row--featured {
  background: rgba(245, 158, 11, 0.04);
}

.browse-table-row--featured:hover {
  background: rgba(245, 158, 11, 0.08);
}

.browse-table-star {
  width: 32px;
  text-align: center;
}

.browse-table-featured-star {
  color: #f5b50a;
  font-size: 15px;
  text-shadow: 0 0 4px rgba(245, 158, 11, 0.3);
}

.browse-table-name {
  min-width: 160px;
}

.browse-table-name-text {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.4;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browse-table-tags {
  margin-top: 4px;
}

.browse-table-tags .fw-tag {
  font-size: 10px;
  padding: 1px 6px;
}

.browse-table-code code {
  color: var(--brand-text);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background var(--tr);
}

.browse-table-code code:hover {
  background: var(--accent-light);
}

.browse-table-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
}

.browse-table-time {
  white-space: nowrap;
  color: var(--text-tertiary);
  font-size: 12px;
}

.browse-table-actions {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .browse-view-btn span {
    display: none;
  }
  .browse-view-btn {
    padding: 8px 10px;
  }
  .browse-table {
    font-size: 12px;
  }
  .browse-table thead th,
  .browse-table tbody td {
    padding: 8px 10px;
  }
}

.browse-extract-btn {
  min-width: 60px;
  border: 0.5px solid var(--brand-border);
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  transition: all var(--tr);
}

.browse-extract-btn:hover {
  opacity: 0.9;
}

.browse-copy-btn {
  min-width: 84px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  transition: all var(--tr);
}

.browse-copy-btn:hover {
  border-color: var(--brand-border);
  color: var(--brand-text);
  background: var(--brand-light);
}

/* 优质项目星标按钮：默认灰色五角星，激活后变金色并播放动画 */
.featured-star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color var(--tr), background var(--tr);
}

.featured-star-btn:hover {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.08);
}

.featured-star-btn:active {
  transform: scale(0.92);
}

.featured-star-btn__icon {
  width: 20px;
  height: 20px;
  fill: var(--text-secondary);
  opacity: 0.45;
  /* 关键：让 transform 以星星自身中心为原点，否则 SVG 默认从左上角缩放，弹跳会被裁切而看不出来 */
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.2s ease, fill 0.2s ease, transform 0.2s ease;
}

.featured-star-btn:hover .featured-star-btn__icon {
  opacity: 0.85;
}

.featured-star-btn.is-active {
  border-color: rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.12);
  box-shadow: 0 1px 6px rgba(245, 158, 11, 0.2);
}

.featured-star-btn.is-active .featured-star-btn__icon {
  fill: #f5b21a;
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.55));
}

/* 点击时星标弹跳放大动画：多弹一次、幅度更大 */
.featured-star-btn.is-animating .featured-star-btn__icon {
  animation: featuredStarPop 0.6s cubic-bezier(0.34, 1.75, 0.4, 1);
}

@keyframes featuredStarPop {
  0%   { transform: scale(0.5) rotate(-18deg); }
  35%  { transform: scale(1.55) rotate(12deg); }
  55%  { transform: scale(0.88) rotate(-4deg); }
  75%  { transform: scale(1.18) rotate(2deg); }
  90%  { transform: scale(0.96); }
  100% { transform: scale(1) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .featured-star-btn.is-animating .featured-star-btn__icon {
    animation: none;
  }
  .featured-star-btn,
  .featured-star-btn__icon {
    transition: none;
  }
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.pagination-btn {
  min-width: 36px;
  min-height: 36px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  transition: all var(--tr);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--brand-border);
  color: var(--brand-text);
  background: var(--brand-light);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-btn.active {
  border-color: var(--brand-border);
  background: var(--brand);
  color: #fff;
}

.pagination-info {
  margin: 0 8px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.page {
  width: min(760px, 100%);
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0 -20px 28px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-weak);
  background: rgba(247, 246, 242, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-home-link {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-weak);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: all var(--tr);
}

.header-home-link:hover {
  color: var(--brand);
  border-color: var(--brand-border);
  background: var(--brand-light);
}

@media (prefers-color-scheme: dark) {
  .header {
    background: rgba(17, 18, 24, 0.9);
  }
}

.header-logo {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(44, 92, 255, 0.25);
}

.header-logo svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.header-text h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-text p {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill {
  font-size: 12px;
  font-weight: 650;
  padding: 5px 12px;
}

.tabs {
  gap: 6px;
  padding: 5px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  .tabs {
    background: rgba(26, 28, 36, 0.85);
  }
}

.tab-btn {
  font-weight: 650;
  border-radius: var(--r-md);
}

.tab-btn.active {
  border: 0;
  background: var(--text-primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.tab-btn.active svg {
  opacity: 1;
}

.panel.active {
  animation: panelIn 0.25s ease;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  border: 1px solid var(--border-weak);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}

.card-header {
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 18px;
}

.card-header-icon {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: var(--brand-light);
}

.card-header-icon svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

.card-kicker {
  margin-bottom: 3px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.card-subtitle {
  margin-top: 4px;
  font-size: 13px;
}

.drop-zone {
  border: 2px dashed rgba(44, 92, 255, 0.22);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #fafbff, var(--brand-light));
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f5f7ff, var(--brand-light));
}

.drop-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--brand);
  box-shadow: 0 4px 12px rgba(44, 92, 255, 0.12);
}

.drop-main {
  font-size: 15px;
  font-weight: 700;
}

.file-bar {
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-weak);
}

.file-bar-icon {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 850;
}

.file-bar-name {
  color: var(--text-primary);
  font-family: var(--font);
  font-weight: 700;
}

.field span,
.form-label {
  font-weight: 700;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 92, 255, 0.12);
}

.exp-btn {
  border-radius: var(--r-pill);
}

.exp-btn.selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(44, 92, 255, 0.25);
}

.upload-btn,
.modal-start-btn {
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 800;
  padding: 13px 16px;
  box-shadow: var(--shadow-btn);
}

.upload-btn:hover:not(:disabled),
.modal-start-btn:hover:not(:disabled) {
  filter: none;
  background: var(--brand-text);
  transform: translateY(-1px);
}

.result-wrap {
  margin-top: 24px;
  padding: 22px;
  border-radius: var(--r-lg);
  background: linear-gradient(145deg, var(--brand-light), var(--bg-surface));
  border: 1px solid rgba(44, 92, 255, 0.15);
  text-align: left;
}

.result-eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.code-block {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.code-value {
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 850;
  letter-spacing: 8px;
  color: var(--brand);
}

.code-copy-btn {
  position: static;
  margin-top: 12px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff;
  border: 0;
  font-weight: 800;
  padding: 8px 14px;
}

.code-copy-btn:hover,
.code-copy-btn.copied {
  background: var(--brand-text);
  color: #fff;
  border: 0;
}

.extract-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--brand-light);
}

.extract-header-icon svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

.extract-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.locker-label {
  font-weight: 700;
  color: var(--text-secondary);
}

.locker-cell {
  width: 42px;
  height: 54px;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  text-align: center;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  background: var(--bg-subtle);
}

.locker-cell.filled {
  border-color: transparent;
  background: linear-gradient(180deg, #3967ff, #2147d8);
  color: #fff;
  box-shadow: 0 8px 16px rgba(44, 92, 255, 0.2);
}

.locker-cell.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 92, 255, 0.15);
}

.kb-key {
  font-weight: 800;
  font-family: var(--mono);
}

.kb-key:hover {
  border-color: rgba(44, 92, 255, 0.25);
  background: var(--brand-light);
  color: var(--brand);
}

.fw-card {
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}

.fw-file-badge {
  border: 0;
  border-radius: 12px;
  background: var(--brand-light);
}

.fw-file-badge svg {
  color: var(--brand);
}

.fw-filename {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.fw-meta-item {
  border-radius: 14px;
}

.fw-btn-flash {
  box-shadow: 0 8px 20px rgba(44, 92, 255, 0.25);
}

.footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-weak);
  color: var(--text-tertiary);
  font-size: 12px;
  text-align: center;
}

.modal-box {
  border-radius: var(--r-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}

.auth-tab.active {
  background: var(--text-primary);
  color: #fff;
}

/* Keep app modals visually aligned with the light app shell, even on dark OS themes. */
.modal-faux {
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e8eef7;
  --border-weak: rgba(15, 23, 42, 0.1);
  --border-mid: rgba(15, 23, 42, 0.18);
  --text-primary: #111827;
  --text-secondary: #475569;
  --text-tertiary: #7b8798;
  --brand: #2f63f6;
  --brand-light: #eaf0ff;
  --brand-border: rgba(47, 99, 246, 0.34);
  --brand-text: #244fc8;
  --teal: #14a06f;
  --teal-light: #e8f7f1;
  --teal-border: rgba(20, 160, 111, 0.24);
  --teal-text: #0f7c56;
  --red-light: #fff0f0;
  --red-border: rgba(218, 62, 62, 0.24);
  --red-text: #b42323;
  background: rgba(15, 23, 42, 0.34);
  color: var(--text-primary);
}

.modal-faux .modal-box {
  border: 1px solid var(--border-weak);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.modal-faux .modal-top {
  border-bottom-color: var(--border-weak);
}

.modal-faux .modal-title {
  color: var(--text-primary);
}

.modal-faux .modal-close {
  color: var(--text-tertiary);
}

.modal-faux .modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-faux .auth-tabs {
  border-color: var(--border-weak);
  background: var(--bg-subtle);
}

.modal-faux .auth-tab {
  color: var(--text-secondary);
}

.modal-faux .auth-tab.active {
  border-color: var(--brand-border);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(47, 99, 246, 0.18);
}

.modal-faux .field span,
.modal-faux .form-label {
  color: #5b6678;
  font-weight: 750;
}

.modal-faux input,
.modal-faux select,
.modal-faux textarea {
  border-color: #d8e1ee;
  background: #f8fafc;
  color: #111827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.modal-faux input:focus,
.modal-faux select:focus,
.modal-faux textarea:focus {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(47, 99, 246, 0.14);
}

.modal-faux .state.muted {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

/* ─── App shell layout (sidebar + main) ─── */
.app-shell {
  --bg-page: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e8eef7;
  --border-weak: rgba(15, 23, 42, 0.1);
  --border-mid: rgba(15, 23, 42, 0.18);
  --border-strong: rgba(15, 23, 42, 0.28);
  --text-primary: #111827;
  --text-secondary: #475569;
  --text-tertiary: #7b8798;
  --brand: #2f63f6;
  --brand-light: #eaf0ff;
  --brand-mid: #6b8eff;
  --brand-border: rgba(47, 99, 246, 0.34);
  --brand-text: #244fc8;
  --teal: #14a06f;
  --teal-light: #e8f7f1;
  --teal-border: rgba(20, 160, 111, 0.24);
  --teal-text: #0f7c56;
  --red-light: #fff0f0;
  --red-border: rgba(218, 62, 62, 0.24);
  --red-text: #b42323;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 82% 6%, rgba(47, 99, 246, 0.12), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--bg-page) 100%);
}

.app-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100vh;
  max-height: 100vh;
  padding: 22px 16px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(248, 250, 252, 0.96);
  border-right: 1px solid var(--border-weak);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.72) inset;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  text-decoration: none;
}

.sidebar-brand-logo {
  display: block;
  width: 176px;
  max-width: 100%;
  height: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 22px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-mid);
  margin: 8px 0;
  opacity: 0.5;
}

.app-sidebar .tab-btn.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.app-sidebar .tab-btn.sidebar-item svg {
  width: 16px;
  height: 16px;
}

.app-sidebar .tab-btn.sidebar-item:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.app-sidebar .tab-btn.sidebar-item.active {
  background: var(--text-primary);
  color: #fff;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
}

.app-shell .app-sidebar #tab-extract.active,
.app-shell .app-sidebar #tab-upload.active,
.app-shell .app-sidebar #tab-profile.active {
  background: var(--text-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14) !important;
}

.app-shell .app-sidebar #tab-extract:not(.active),
.app-shell .app-sidebar #tab-upload:not(.active),
.app-shell .app-sidebar #tab-profile:not(.active) {
  background: transparent !important;
  color: var(--text-secondary) !important;
  box-shadow: none !important;
}

.sidebar-card {
  padding: 14px;
  border: 1px solid var(--border-weak);
  border-radius: 16px;
  background: var(--bg-surface);
  margin-top: auto;
  color: var(--text-primary);
}

.sidebar-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.sidebar-card span {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.55;
}

.sidebar-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
}

.toolbox-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  overflow: hidden;
  transition: grid-template-columns 0.24s ease;
}

.toolbox-layout.tool-open {
  grid-template-columns: 72px minmax(0, 1fr);
}

.toolbox-collection {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, 100%);
  justify-self: center;
  transition: width 0.24s ease, justify-self 0.24s ease;
}

.toolbox-layout.tool-open .toolbox-collection {
  width: 72px;
  justify-self: stretch;
}

.toolbox-tool {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 13px;
  border: 1px solid var(--border-weak);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: width 0.24s ease, padding 0.24s ease, border-color 0.16s ease, background 0.16s ease;
}

.toolbox-tool.active {
  border-color: var(--brand-border);
  background: var(--brand-light);
}

.toolbox-tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand);
}

.toolbox-tool-icon svg {
  width: 20px;
  height: 20px;
}

.toolbox-tool-icon img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}

.toolbox-tool strong,
.toolbox-tool small {
  display: block;
}

.toolbox-tool strong {
  font-size: 13px;
  font-weight: 800;
}

.toolbox-tool small {
  margin-top: 3px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.toolbox-layout.tool-open .toolbox-tool {
  grid-template-columns: 38px;
  justify-content: center;
  padding: 13px 16px;
}

.toolbox-layout.tool-open .toolbox-tool strong,
.toolbox-layout.tool-open .toolbox-tool small {
  display: none;
}

.toolbox-workbench {
  min-width: 0;
  padding: 0;
  border: 1px solid var(--border-weak);
  border-width: 0;
  border-radius: 12px;
  background: #ffffff;
  opacity: 0;
  transform: translateX(42px);
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.24s ease, transform 0.24s ease, max-height 0.24s ease, padding 0.24s ease, border-width 0.24s ease;
}

.toolbox-workbench.active {
  padding: 18px;
  border-width: 1px;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  max-height: 1200px;
  overflow: visible;
}

.toolbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 8px 0 4px;
}

.toolbox-empty .toolbox-collection {
  width: min(360px, 100%);
}

.toolbox-tool-link {
  text-decoration: none;
}

.toolbox-tool-link:hover {
  border-color: var(--brand-border);
  background: var(--brand-light);
}

.toolbox-hint {
  margin: 0;
  max-width: 520px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1.7;
}

.app-main-wrap {
  min-width: 0;
}

.app-main {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 28px 28px 40px;
}

.app-panel {
  width: 100%;
}

.app-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.app-kicker {
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-title {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 800;
  line-height: 1.18;
  color: var(--text-primary);
  letter-spacing: 0;
}

.app-subtitle {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.verify-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eaf8f1;
  color: #108552;
  font-size: 12px;
  font-weight: 750;
}

.verify-badge i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #18a76a;
  box-shadow: 0 0 0 4px rgba(24, 167, 106, 0.14);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.firmware-panel {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--border-weak);
  border-radius: 22px;
  background: var(--bg-surface);
  box-shadow: 0 16px 38px rgba(27, 35, 56, 0.07);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.code-header > span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.copy-chip {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  transition: background 0.15s;
}

.copy-chip:hover {
  background: rgba(44, 92, 255, 0.16);
}

.extract-entry .locker-label {
  display: none;
}

.locker-cells {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.code-gap {
  width: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 18px;
  font-weight: 800;
  user-select: none;
}

.locker-cell.filled.accent {
  border-color: transparent;
  background: linear-gradient(180deg, #3967ff, #2147d8);
  color: #fff;
  box-shadow: 0 10px 18px rgba(44, 92, 255, 0.22);
}

.locker-cell.filled.secondary {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(180deg, #f9faff, #eef1f6);
  color: var(--text-primary);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.04);
}

.locker-cell.empty-dot.accent {
  background: rgba(44, 92, 255, 0.06);
  border: 1px dashed rgba(44, 92, 255, 0.18);
  color: rgba(44, 92, 255, 0.35);
}

.locker-cell.empty-dot.secondary {
  background: #f3f4f7;
  border: 1px dashed rgba(0, 0, 0, 0.1);
  color: var(--text-tertiary);
}

.firmware-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.meta-card {
  padding: 12px;
  border: 1px solid var(--border-weak);
  border-radius: 16px;
  background: var(--bg-subtle);
}

.meta-card small {
  display: block;
  margin-bottom: 2px;
  color: var(--text-tertiary);
  font-size: 11px;
}

.meta-card strong {
  display: block;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-card-extra {
  display: none;
}

.fw-card {
  margin-top: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.fw-card:not(.show) {
  display: none;
}

.transfer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 15px 16px;
  border-radius: 18px;
  background: rgba(13, 13, 13, 0.94);
  color: #fff;
}

.transfer-row .progress-copy {
  min-width: 0;
}

.transfer-row .progress-copy strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.transfer-row .progress-copy span {
  display: block;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
}

.transfer-row .progress-track {
  height: 8px;
  margin-top: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.progress-fill-transfer {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #4ade80);
  transition: width 0.35s ease;
}

.transfer-row.ready .progress-fill-transfer {
  width: 74%;
}

.transfer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.flash-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border: 0;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.flash-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.flash-button-primary {
  background: #fff;
  color: var(--text-primary);
  font-weight: 850;
}

.flash-button-primary:hover:not(:disabled) {
  background: #f3f4f6;
}

.flash-button svg {
  width: 15px;
  height: 15px;
}

.upload-panel {
  padding: 20px;
  border: 1px solid var(--border-weak);
  border-radius: 22px;
  background: var(--bg-surface);
  box-shadow: 0 16px 38px rgba(27, 35, 56, 0.07);
}

.profile-panel {
  padding: 20px;
  border: 1px solid var(--border-weak);
  border-radius: 22px;
  background: var(--bg-surface);
  box-shadow: 0 16px 38px rgba(27, 35, 56, 0.07);
}

.app-shell .app-kicker {
  color: var(--brand);
}

.app-shell .app-title {
  color: #0f172a;
}

.app-shell .app-subtitle {
  color: #526070;
}

.app-shell .upload-panel,
.app-shell .firmware-panel,
.app-shell .profile-panel {
  box-shadow: 0 18px 42px rgba(30, 41, 59, 0.08);
}

.app-shell .drop-zone {
  border-color: #c8d7ff;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5ff 100%);
}

.app-shell .drop-zone:hover,
.app-shell .drop-zone.drag-over {
  border-color: var(--brand);
  background: linear-gradient(180deg, #ffffff 0%, #e8efff 100%);
}

.app-shell .drop-icon {
  background: #ffffff;
  color: var(--brand);
}

.app-shell .drop-main {
  color: #0f172a;
}

.app-shell .drop-sub {
  color: #687587;
}

/* ===================== USER MANAGEMENT ===================== */

.users-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.users-chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-weak);
  border-radius: var(--r-md);
  padding: 16px;
}

.users-chart-title {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

.users-chart-card canvas {
  max-height: 180px;
  width: 100% !important;
}

.users-table-wrap {
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-weak);
  border-radius: var(--r-md);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.users-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-weak);
  white-space: nowrap;
}

.users-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-weak);
  color: var(--text-primary);
  vertical-align: middle;
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

.users-table tbody tr:hover {
  background: var(--bg-hover);
}

.users-email-cell {
  color: var(--text-tertiary);
  font-size: 13px;
}

.users-date-cell {
  color: var(--text-tertiary);
  font-size: 13px;
  white-space: nowrap;
}

.users-self-tag {
  margin-left: 4px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.users-role-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.users-role-user {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.users-role-admin {
  background: linear-gradient(135deg, #e8e8e8, #c0c0c0);
  color: #555;
  border: 1px solid #b0b0b0;
}

.users-role-super_admin {
  background: linear-gradient(135deg, #1a1a1a, #3d3d3d);
  color: #ffd700;
  border: 1px solid #ffd700;
  text-shadow: 0 0 4px rgba(255, 215, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  .users-role-admin {
    background: linear-gradient(135deg, #5a5a5a, #3a3a3a);
    color: #d0d0d0;
    border: 1px solid #707070;
  }

  .users-role-super_admin {
    background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
    color: #ffd700;
    border: 1px solid #d4af37;
  }
}

.users-status-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
}

.users-status-active {
  background: var(--teal-light);
  color: var(--teal-text);
}

.users-status-banned {
  background: var(--red-light);
  color: var(--red-text);
}

.users-actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 8px;
  align-items: center;
}

.users-ban-btn,
.users-unban-btn {
  padding: 4px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border-mid);
  background: var(--bg-surface);
  transition: all var(--tr);
}

.users-ban-btn {
  color: var(--red-text);
  border-color: var(--red-border);
}

.users-ban-btn:hover {
  background: var(--red-light);
}

.users-unban-btn {
  color: var(--teal-text);
  border-color: var(--teal-border);
}

.users-unban-btn:hover {
  background: var(--teal-light);
}

.users-role-select {
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 13px;
  border: 1px solid var(--border-mid);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
}

@media (max-width: 768px) {
  .users-charts {
    grid-template-columns: 1fr;
  }
}

.app-shell .field span,
.app-shell .form-label {
  color: #5b6678;
  font-weight: 750;
}

.app-shell input,
.app-shell select,
.app-shell textarea {
  border-color: #d8e1ee;
  background: #f8fafc;
  color: #111827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.app-shell input::placeholder,
.app-shell textarea::placeholder {
  color: #8995a7;
  opacity: 1;
}

.app-shell input:focus,
.app-shell select:focus,
.app-shell textarea:focus {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(47, 99, 246, 0.14);
}

.app-shell .exp-btn {
  border-color: #d8e1ee;
  background: #f8fafc;
  color: #48576a;
}

.app-shell .exp-btn.selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(47, 99, 246, 0.22);
}

.app-shell .toggle-row {
  border-color: #d8e1ee;
  background: #f8fafc;
}

.app-shell .toggle-desc {
  color: #687587;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    max-height: none;
    overflow-y: visible;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  }

  .sidebar-brand {
    margin-bottom: 0;
  }

  .sidebar-brand-logo {
    width: 150px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex: 1;
    justify-content: flex-end;
    margin-bottom: 0;
  }

  .sidebar-card,
  .sidebar-status {
    display: none;
  }

  .app-main {
    padding: 20px 16px 32px;
  }

  .firmware-meta {
    grid-template-columns: 1fr;
  }

  .transfer-row {
    grid-template-columns: 1fr;
  }

  .transfer-actions {
    justify-content: stretch;
  }

  .transfer-actions .flash-button {
    flex: 1;
    justify-content: center;
  }
}

/* ─── Mobile application shell ─── */
@media (max-width: 600px) {
  body {
    overflow-x: clip;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 120;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 10px 12px 8px;
    background: rgba(248, 250, 252, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  }

  .sidebar-brand {
    min-width: 0;
    margin: 0;
  }

  .sidebar-brand-logo {
    width: min(142px, 100%);
  }

  .sidebar-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    min-width: 0;
    margin: 0;
  }

  .sidebar-status #healthBadge {
    display: none;
  }

  .sidebar-status .status-pill {
    min-height: 36px;
    max-width: 92px;
    margin: 0;
    padding: 6px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-status .auth-logout {
    max-width: none;
  }

  .sidebar-nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    margin: 0;
  }

  .sidebar-divider {
    display: none;
  }

  .app-sidebar .tab-btn.sidebar-item {
    flex-direction: column;
    gap: 3px;
    width: 100%;
    min-width: 0;
    height: 52px;
    padding: 5px 2px;
    font-size: 11px;
    line-height: 1.05;
    text-align: center;
    white-space: nowrap;
  }

  .app-sidebar .tab-btn.sidebar-item svg {
    width: 17px;
    height: 17px;
  }

  .app-main {
    padding: 16px 12px 30px;
  }

  .app-head {
    gap: 10px;
    margin-bottom: 16px;
  }

  .app-kicker {
    font-size: 10px;
  }

  .app-title {
    font-size: 22px;
  }

  .app-subtitle {
    margin-top: 5px;
    font-size: 13px;
  }

  .upload-panel,
  .profile-panel,
  .firmware-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .browse-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .browse-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    overflow: visible;
  }

  .browse-search-wrap {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .browse-search-input {
    width: 100%;
    height: 44px;
  }

  .browse-filter {
    display: grid;
    gap: 4px;
    min-width: 0;
    white-space: normal;
  }

  .browse-filter select {
    width: 100%;
    height: 44px;
    min-width: 0;
    padding-inline: 9px 28px;
  }

  .browse-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    width: 100%;
  }

  .browse-total {
    align-self: center;
    min-width: 0;
    line-height: 1.35;
  }

  .browse-view-toggle {
    justify-self: start;
    min-height: 44px;
  }

  .browse-actions .profile-refresh-btn {
    min-height: 44px;
  }

  .browse-actions .profile-refresh-btn:last-child {
    width: 100%;
  }

  .browse-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(145px, 100%), 1fr));
  }

  .browse-grid-card {
    min-width: 0;
  }

  .browse-item {
    padding: 13px;
    border-radius: 16px;
  }

  .browse-item-actions,
  .profile-item-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .browse-item-actions > *,
  .profile-item-actions > * {
    min-width: 0;
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }

  .browse-item-votes {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toggle-row {
    align-items: flex-start;
    padding: 12px;
  }

  .toggle-desc {
    font-family: var(--font);
    line-height: 1.55;
  }

  .switch {
    margin-top: 2px;
  }

  .field input,
  .field select,
  .field textarea,
  .profile-refresh-btn,
  .upload-btn,
  .modal-start-btn,
  .exp-btn {
    min-height: 44px;
  }

  .image-upload-zone {
    min-height: 132px;
    height: auto;
    padding: 20px 12px;
  }

  .image-preview-item {
    width: calc(33.333% - 8px);
    height: auto;
    aspect-ratio: 1;
  }

  .image-preview-delete {
    width: 28px;
    height: 28px;
    top: 5px;
    right: 5px;
  }

  .modal-faux {
    align-items: flex-end;
    padding: 12px 0 0;
  }

  .modal-box,
  .project-detail-box,
  .auth-box,
  .reset-box,
  .edit-box,
  .delete-box {
    width: 100%;
    max-height: calc(100dvh - 12px);
    padding: 16px 14px max(16px, env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
  }

  .modal-close {
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin: -8px -8px -8px 0;
  }

  .auth-tab,
  .auth-link-btn,
  #sendEmailCodeBtn,
  #sendResetCodeBtn {
    min-height: 44px;
  }

  .reset-actions,
  .edit-actions,
  .delete-actions {
    position: sticky;
    bottom: 0;
    padding-top: 10px;
    background: var(--bg-surface);
  }

  .users-chart-card {
    padding: 12px;
  }

  .users-table-wrap,
  .browse-table-wrap {
    margin-inline: -4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 350px) {
  .sidebar-brand-logo {
    width: 132px;
  }

  .sidebar-status .status-pill {
    max-width: 78px;
    padding-inline: 8px;
    font-size: 10px;
  }

  .app-sidebar .tab-btn.sidebar-item {
    font-size: 10px;
  }

  .app-main {
    padding-inline: 10px;
  }

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

  .browse-total {
    grid-column: 1 / -1;
  }
}

/* Project Mode Styling */

.project-fields-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
  padding: 16px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
}

.image-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 120px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all var(--tr);
}

.image-upload-zone input[type="file"] {
  display: none !important;
}


.image-upload-zone:hover,
.image-upload-zone.dragover {
  border-color: var(--brand);
  background: var(--bg-hover);
}

.image-upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  pointer-events: none;
}

.image-upload-prompt svg {
  width: 28px;
  height: 28px;
  color: var(--text-tertiary);
}

.image-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.image-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 0.5px solid var(--border-weak);
  animation: fadeIn 0.2s ease;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.image-preview-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #ffffff;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.15s ease;
}

.image-preview-delete:hover {
  transform: scale(1.15);
}

/* Details Section Styling */

.project-details-card {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 0.5px solid var(--border-weak);
}

.project-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.project-section-icon {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 0.5px solid var(--border-weak);
  cursor: pointer;
  transition: transform var(--tr), box-shadow var(--tr);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.gallery-item:hover img {
  transform: scale(1.06);
}

.project-section-video-title {
  margin-top: 14px;
}

.project-video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 0.5px solid var(--border-weak);
}

.bilibili-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.bilibili-external-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand-text);
  font-size: 13px;
  text-decoration: none;
  margin-top: 8px;
  transition: color var(--tr);
}

.bilibili-external-link:hover {
  color: var(--text-primary);
}

/* Lightbox Modal */

.lightbox-modal {
  position: fixed;
  z-index: 500;
  padding-top: 40px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lightbox-modal.show {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 85vh;
  border-radius: var(--r-sm);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.lightbox-modal.show .lightbox-content {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: 700;
  transition: 0.3s;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* Project Mode tag */
.fw-tag--project {
  border: 0.5px solid rgba(13, 148, 136, 0.24);
  background: rgba(13, 148, 136, 0.08);
  color: #0d9488;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* Project Carousel */
.project-carousel {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border-weak);
  background: var(--bg-secondary);
}

.carousel-track {
  width: 100%;
  height: 100%;
  position: relative;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide.active {
  opacity: 1;
  z-index: 2;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.36);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s, background 0.3s;
  font-size: 16px;
  user-select: none;
}

.project-carousel:hover .carousel-btn {
  opacity: 1;
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.65);
}

.carousel-btn.prev-btn {
  left: 10px;
}

.carousel-btn.next-btn {
  right: 10px;
}

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.24);
  padding: 4px 8px;
  border-radius: 10px;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}

.carousel-dot.active {
  background: #fff;
  transform: scale(1.15);
}

/* Carousel Video Slide Custom styling */
.carousel-video-slide {
  background: #000; /* dark background for videos */
}

.video-cover-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.video-cover-container.no-cover {
  background: linear-gradient(135deg, #1f1f1f, #0d0d0d);
}

.video-cover-container.no-cover::before {
  content: 'Bilibili 视频';
  color: var(--text-weak, #888);
  font-size: 14px;
  font-weight: 500;
  position: absolute;
  bottom: 24px;
}

/* Add a video camera icon for cover fallbacks */
.video-cover-container.no-cover::after {
  content: '📺';
  font-size: 36px;
  position: absolute;
  top: calc(50% - 6px);
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.7;
}

.video-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.video-cover-container:hover .video-cover-img {
  opacity: 0.95;
}

.video-play-btn {
  position: absolute;
  width: 52px;
  height: 52px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 0.2s, background-color 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 5;
}

.video-play-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  transform: translateX(2px); /* offset triangle slightly to center visually */
}

.video-cover-container:hover .video-play-btn {
  transform: scale(1.1);
  background: #00aeec; /* Bilibili blue */
  border-color: #00aeec;
}

/* Make iframe full size inside the slide */
.carousel-video-slide .project-video-wrapper {
  width: 100%;
  height: 100%;
}

.carousel-video-slide .project-video-wrapper iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Split layout for project details modal (carousel left, description right) */
.project-details-split {
  display: flex;
  gap: 24px;
  align-items: stretch;
  margin-top: 12px;
}

.project-details-left {
  flex: 1.2;
  max-width: 480px;
  width: 100%;
}

.project-details-right {
  flex: 0.8;
  min-width: 180px;
  background: var(--surface-2, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-sm, var(--r-sm, 6px));
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.project-details-desc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.project-details-desc-content {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap; /* preserve linebreaks */
  word-break: break-all;
  flex: 1;
  overflow-y: auto;
  max-height: 240px; /* limit height if description is very long */
}

@media (max-width: 768px) {
  .project-details-split {
    flex-direction: column;
  }
  .project-details-left {
    max-width: 100%;
  }
  .project-details-right {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .browse-item-header {
    grid-template-columns: 1fr;
  }

  .browse-item-actions,
  .profile-item-actions {
    justify-content: flex-start;
  }

  .browse-item-body {
    grid-template-columns: 1fr;
  }

  .project-carousel {
    max-width: 100%;
  }
}

/* GitHub link button in firmware card actions */
.github-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.github-link-btn:visited {
  color: inherit;
}

.github-link-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.github-link-btn svg {
  flex-shrink: 0;
}
