@font-face {
  font-family: "BalooWord";
  src: url("vendor/baloo2-word.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #0f2547;
  --muted: #8494ab;
  --bg: #f2f5fa;
  --card: #ffffff;
  --line: #dbe4f0;
  --danger: #dc2626;
  --radius: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--blue); }

.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-icon { width: 40px; height: 40px; border-radius: 10px; }
.wordmark {
  font-family: "BalooWord", -apple-system, sans-serif;
  font-size: 26px; font-weight: 700; line-height: 1; color: var(--ink);
  letter-spacing: 0.2px;
}
.wordmark-ku { color: var(--blue); }
.tagline { font-size: 9.5px; letter-spacing: 2.6px; color: var(--muted); margin-top: 1px; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle { display: flex; background: #e8eef7; border-radius: 999px; padding: 2px; }
.lang-btn { border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.lang-btn.lang-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 37, 71, 0.18); }
.version-badge { font-size: 12px; font-weight: 600; color: var(--blue); background: #e3ecfd; padding: 5px 10px; border-radius: 999px; }

.container { max-width: 560px; margin: 0 auto; padding: 18px 16px 28px; }

.btn {
  border: 0; border-radius: 14px; padding: 13px 18px;
  font-size: 15.5px; font-weight: 600; text-align: center;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-secondary { background: #e8eef7; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-small { padding: 8px 13px; font-size: 13.5px; border-radius: 10px; }
.btn-danger { color: var(--danger); }

.pick-card {
  width: 100%; padding: 44px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--card); color: var(--blue);
  border: 2px dashed #b9cdf3; border-radius: var(--radius);
  font-size: 17px; font-weight: 600;
}
.pick-card:active { background: #eef4fe; }

.stage-wrap {
  position: relative; margin: 4px auto 6px;
  width: min(100%, 380px);
  border-radius: 14px; overflow: hidden;
  background: #dfe7f2;
  box-shadow: 0 6px 24px rgba(15, 37, 71, 0.13);
  touch-action: pan-y;
}
#preview { display: block; width: 100%; height: auto; }
.guide { position: absolute; inset: 0; pointer-events: none; }
.guide-oval {
  position: absolute; left: 50%; top: 44%;
  width: 56%; aspect-ratio: 0.78;
  transform: translate(-50%, -50%);
  border: 1.5px dashed rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(15, 37, 71, 0.25);
}
.guide-line {
  position: absolute; left: 12%; right: 12%; top: 33%;
  border-top: 1px dashed rgba(255, 255, 255, 0.65);
}

.group-label { font-size: 13px; font-weight: 700; letter-spacing: 0.4px; color: var(--muted); margin: 16px 2px 8px; text-transform: uppercase; }
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 9px 16px; font-size: 14.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip-active { border-color: var(--blue); background: #e3ecfd; color: var(--blue-dark); }
.dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.dot-white { background: #fff; border: 1.5px solid #c4cfdd; }
.dot-blue { background: #0f5fa8; }
.dot-red { background: #e30613; }
#dot-custom { background: #7c3aed; border: 1.5px solid rgba(15, 37, 71, 0.25); }
#chip-custom { position: relative; }
#bg-color { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.bg-status { font-size: 13px; color: var(--muted); margin-top: 8px; }

.slider-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.slider-row label { width: 92px; font-size: 14px; font-weight: 600; color: var(--ink); flex-shrink: 0; }

.action-col { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }

.dev-footer { margin-top: 30px; text-align: center; }
.dev-by { font-size: 13px; color: var(--muted); }
.dev-credit { color: var(--blue); font-weight: 700; text-decoration: none; }

.dialog {
  border: 0; border-radius: 20px; padding: 22px;
  width: min(92vw, 340px); margin: auto;
  background: var(--card); color: var(--ink);
}
.dialog::backdrop { background: rgba(10, 22, 40, 0.5); }
.dialog-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }

.busy {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(255, 255, 255, 0.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 4px solid #c9d9f6; border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.busy-label { font-size: 14.5px; font-weight: 600; color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 70; max-width: 88vw;
  background: #10233f; color: #fff;
  font-size: 14px; font-weight: 500;
  padding: 11px 16px; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(10, 22, 40, 0.35);
  text-align: center;
}
