:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #ffffff;
  --text: #20211e;
  --muted: #777970;
  --line: #e9e9e3;
  --accent: #1e6e52;
  --shadow: 0 12px 35px rgb(34 42 37 / 7%);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: "Noto Sans KR", sans-serif;
  transition: background-color .25s ease, color .25s ease;
}

body.dark-mode {
  color-scheme: dark;
  --page: #171a18;
  --surface: #202420;
  --text: #f2f3ed;
  --muted: #acb0a9;
  --line: #363a35;
  --accent: #80c6a4;
  --shadow: 0 12px 35px rgb(0 0 0 / 18%);
}

button { font: inherit; }

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

.app-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 38px; }

.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-decoration: none; }
.brand-mark { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; background: var(--accent); color: #fff; font-size: .95rem; letter-spacing: 0; }

.icon-button, .text-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; font-size: 1.15rem; transition: border-color .2s, color .2s, transform .2s; }
.icon-button:hover { color: var(--accent); border-color: var(--accent); transform: rotate(12deg); }

.picker-card { padding: 42px 38px 38px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .68rem; font-weight: 700; letter-spacing: .13em; }
h1, h2 { margin: 0; letter-spacing: -.04em; }
h1 { font-size: clamp(1.8rem, 6vw, 2.45rem); }
h2 { font-size: 1.15rem; }
.intro { margin: 12px 0 34px; color: var(--muted); font-size: .92rem; line-height: 1.7; }

.balls-container { display: flex; min-height: 64px; margin-bottom: 32px; align-items: center; justify-content: center; gap: 9px; }
.placeholder { margin: 0; color: var(--muted); font-size: .9rem; }
.ball { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 50%; color: #fff; font-size: 1.12rem; font-weight: 700; box-shadow: inset -4px -5px 10px rgb(0 0 0 / 12%); opacity: 0; transform: translateY(8px) scale(.88); transition: opacity .28s ease, transform .28s cubic-bezier(.2, .9, .35, 1.25); }
.ball.show { opacity: 1; transform: translateY(0) scale(1); }
.color-1 { background: #e7ad25; } .color-2 { background: #4f9bc4; } .color-3 { background: #df6a61; } .color-4 { background: #858984; } .color-5 { background: #7aa84c; }

.generate-button { width: 100%; padding: 14px 20px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer; font-weight: 700; transition: filter .2s, transform .2s; }
.generate-button:hover:not(:disabled) { filter: brightness(.93); transform: translateY(-1px); }
.generate-button:disabled { cursor: wait; opacity: .55; }

.history-section { padding: 36px 4px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.text-button { padding: 4px 0; color: var(--muted); font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--accent); }
.history-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.history-item { display: flex; min-height: 58px; align-items: center; gap: 16px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.history-index { flex: 0 0 24px; color: var(--muted); font-size: .76rem; font-weight: 700; }
.history-balls { display: flex; flex-wrap: wrap; gap: 5px; }
.history-ball { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: #fff; font-size: .67rem; font-weight: 700; }
.empty-history { margin: 0; padding: 22px 0; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .88rem; text-align: center; }

@media (max-width: 480px) {
  .app-shell { width: min(100% - 28px, 640px); padding-top: 18px; }
  .app-header { margin-bottom: 26px; }
  .picker-card { padding: 32px 18px 24px; }
  .balls-container { gap: 6px; }
  .ball { width: 43px; height: 43px; font-size: .95rem; }
  .history-item { gap: 8px; padding: 10px; }
}
