:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --fg: #1c1c1e;
  --muted: #64646b;
  --border: rgba(0, 0, 0, 0.09);
  --accent: #4f46e5;
  --accent-fg: #ffffff;
  --danger: #c2410c;
  --success: #15803d;
  --star: #f5a524;
  --star-empty: #d4d4d8;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #1c1c1f;
    --fg: #ededef;
    --muted: #a0a0a8;
    --border: rgba(255, 255, 255, 0.09);
    --accent: #818cf8;
    --accent-fg: #0b0b0f;
    --danger: #fb923c;
    --success: #4ade80;
    --star-empty: #3f3f46;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.container { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.container.narrow { max-width: 620px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.topbar h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.1rem); letter-spacing: -0.02em; }
.topbar .actions { display: flex; align-items: center; gap: 10px; }
.lead { color: var(--muted); margin: -16px 0 28px; }

.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface); }
.lang-switch button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--accent-fg); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.secondary { background: transparent; border-color: var(--border); color: var(--fg); }
.btn.danger { background: transparent; border-color: var(--border); color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 0.9rem; }

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

/* Forms */
.field { margin-bottom: 20px; }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
input[type="text"], input[type="url"], textarea {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { min-height: 140px; resize: vertical; }

.segmented { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.segmented label { padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 0.9rem; color: var(--muted); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { color: var(--fg); }
.segmented label:has(input:checked) { background: var(--bg); color: var(--fg); }

.avatar-row { display: flex; align-items: center; gap: 14px; }
.avatar-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--bg); border: 1px solid var(--border); flex: none; }

/* Star rating input (radios in reverse order so CSS can fill to the left) */
.stars-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; border: 0; padding: 0; margin: 0; }
.stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-input label { font-size: 2rem; line-height: 1; color: var(--star-empty); cursor: pointer; transition: transform 0.1s; }
.stars-input label:hover, .stars-input label:hover ~ label,
.stars-input input:checked ~ label { color: var(--star); }
.stars-input input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.notice.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.notice.success { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

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