:root {
  --phoenix: #E8620A;
  --phoenix-dark: #C7510A;
  --ember: #8B2500;
  --black: #0A0A0A;
  --offwhite: #F5F5F5;
  --slate: #444444;
  --slate-light: #6B6B6B;
  --border: #E2E2E2;
  --border-strong: #C8C8C8;
  --bg: #FAFAFA;
  --panel: #FFFFFF;
  --vintage-bg: #FFF1EC;
  --vintage-border: rgba(139, 37, 0, 0.28);
  --danger: #B22222;
  --danger-bg: #FBE9E9;
  --shadow-sm: 0 1px 2px rgba(10,10,10,0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --focus: 0 0 0 3px rgba(232, 98, 10, 0.38);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--black);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 720px) {
  .container { padding: 0 1.5rem; }
}

/* ---------- Header ---------- */
.site-header {
  background: var(--black);
  color: var(--offwhite);
  padding: 1.1rem 0;
  border-bottom: 3px solid var(--phoenix);
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--offwhite);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  width: fit-content;
  border-radius: var(--radius-sm);
}

.brand:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.brand-mark {
  color: var(--phoenix);
  font-size: 1.2rem;
  line-height: 1;
}

.tagline {
  margin: 0;
  font-size: 0.9rem;
  color: #C8C8C8;
}

@media (min-width: 720px) {
  .header-inner { flex-direction: row; align-items: baseline; gap: 1.5rem; flex-wrap: wrap; }
  .brand { font-size: 1.55rem; }
}

/* ---------- Main ---------- */
.site-main {
  flex: 1;
  padding: 1.5rem 0 2rem;
}

@media (min-width: 720px) {
  .site-main { padding: 2.5rem 0 3rem; }
}

/* ---------- Panel ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 720px) {
  .panel { padding: 1.6rem 1.75rem; margin-bottom: 1.5rem; }
}

.panel-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--black);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.panel-head .panel-title { margin: 0; }

.frame-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.2rem 0.7rem;
  background: var(--phoenix);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.placeholder {
  color: var(--slate-light);
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- Form ---------- */
.frame-form {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 560px) {
  .frame-form {
    grid-template-columns: 1fr 130px auto;
    column-gap: 0.75rem;
    align-items: end;
  }
  .frame-form .field-error { grid-column: 1 / -1; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate);
}

.field input {
  font: inherit;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--black);
  width: 100%;
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder { color: var(--slate-light); }

.field input:focus,
.field input:focus-visible {
  outline: none;
  border-color: var(--phoenix);
  box-shadow: var(--focus);
}

.field-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0;
  min-height: 1.1em;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  min-height: 44px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  color: var(--black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn-primary {
  background: var(--phoenix);
  color: #fff;
  border-color: var(--phoenix);
}

.btn-primary:hover { background: var(--phoenix-dark); border-color: var(--phoenix-dark); }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--slate);
  border-color: var(--border-strong);
}

.btn-ghost:hover { background: var(--bg); color: var(--black); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}

.btn-danger:hover { background: var(--danger-bg); }

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  min-height: 36px;
}

/* ---------- Frame list ---------- */
.frame-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.frame-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "info actions";
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.frame-item.is-vintage {
  background: var(--vintage-bg);
  border-color: var(--vintage-border);
}

.frame-info { grid-area: info; min-width: 0; }

.frame-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--black);
  margin: 0 0 0.15rem;
  word-break: break-word;
}

.frame-year {
  font-size: 0.85rem;
  color: var(--slate-light);
  margin: 0;
}

.frame-item.is-vintage .frame-year {
  color: var(--ember);
  font-weight: 600;
}

.vintage-badge {
  display: inline-block;
  margin-left: 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ember);
  background: rgba(139, 37, 0, 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  vertical-align: middle;
}

.frame-actions {
  grid-area: actions;
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

@media (max-width: 419px) {
  .frame-item {
    grid-template-columns: 1fr;
    grid-template-areas: "info" "actions";
  }
  .frame-actions { justify-content: flex-end; }
}

/* Inline edit row */
.frame-edit {
  display: grid;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: #FFF8F2;
  border: 1px solid var(--phoenix);
  border-radius: var(--radius-sm);
}

@media (min-width: 560px) {
  .frame-edit {
    grid-template-columns: 1fr 120px auto auto;
    column-gap: 0.6rem;
    align-items: end;
  }
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 1.75rem 1rem 1.25rem;
  color: var(--slate);
}

.empty-state-headline {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--black);
}

.empty-state-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--slate-light);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  background: var(--black);
  color: #C8C8C8;
  padding: 1.1rem 0;
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
}

@media (min-width: 560px) {
  .footer-inner { flex-direction: row; justify-content: space-between; align-items: center; }
}

.disclaimer, .credit { margin: 0; }

.site-footer a {
  color: var(--phoenix);
  text-decoration: none;
  font-weight: 600;
  border-radius: 3px;
}

.site-footer a:hover { text-decoration: underline; }
.site-footer a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

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

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