:root {
  --ink: #171c2b;
  --ink-soft: #656a78;
  --paper: #f4f1e9;
  --panel: rgba(255, 255, 255, 0.78);
  --line: rgba(23, 28, 43, 0.11);
  --lime: #c8f135;
  --lime-deep: #a8cd20;
  --purple: #7058e8;
  --yellow: #f3b83c;
  --blue: #5593d8;
  --red: #eb6464;
  --gray: #7d8490;
  --green: #65aa7a;
  --shadow: 0 28px 70px rgba(36, 39, 52, 0.12);
  --radius-xl: 32px;
  --radius-lg: 22px;
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

:root[data-theme=dark] {
  color-scheme: dark;
  --ink: #f4f1e9;
  --ink-soft: #afb3bf;
  --paper: #10131c;
  --panel: rgba(28, 32, 45, 0.9);
  --line: rgba(255, 255, 255, 0.11);
  --lime: #d0f64b;
  --lime-deep: #b6da2e;
  --purple: #a998ff;
  --yellow: #f3bd47;
  --blue: #4f8ece;
  --red: #dd5e64;
  --gray: #707886;
  --green: #5ba574;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 22% 0%, rgba(200, 241, 53, 0.13), transparent 26rem),
    radial-gradient(circle at 98% 50%, rgba(112, 88, 232, 0.08), transparent 30rem),
    var(--paper);
  color: var(--ink);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(112, 88, 232, 0.42);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(3px);
  pointer-events: none;
}

.ambient-one {
  top: 27%;
  left: -180px;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(112, 88, 232, 0.11);
}

.ambient-two {
  right: -250px;
  bottom: 10%;
  width: 480px;
  height: 480px;
  border: 1px solid rgba(200, 241, 53, 0.22);
}

.site-header,
main,
footer {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  gap: 3px;
  width: 27px;
  height: 27px;
  padding: 4px;
  border-radius: 8px;
  background: var(--ink);
  transform: rotate(-4deg);
}

.brand-mark i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lime);
}

.brand-mark i:nth-child(2),
.brand-mark i:nth-child(5) {
  background: #fff;
}

.brand-name {
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.lotto-badge,
.secure-random {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.lotto-badge {
  margin-left: auto;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 108px;
  height: 38px;
  margin-left: 10px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.48);
  color: #4f5564;
  cursor: pointer;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: background 180ms ease, color 180ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  border-color: rgba(112, 88, 232, 0.45);
  transform: translateY(-1px);
}

.theme-button-label {
  position: relative;
  z-index: 1;
}

.theme-button-icon {
  color: #7058e8;
  font-size: 1rem;
  line-height: 1;
}

.lotto-badge i,
.secure-random i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime-deep);
  box-shadow: 0 0 0 4px rgba(200, 241, 53, 0.2);
}

.hero {
  padding: 70px 0 58px;
  text-align: center;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: #706c62;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--purple);
  letter-spacing: -0.01em;
}

.eyebrow span {
  font-size: 0.9rem;
}

.hero h1 {
  margin: 18px 0 20px;
  font-size: clamp(2.75rem, 6vw, 5rem);
  line-height: 1.08;
  letter-spacing: -0.065em;
}

.hero h1 em {
  position: relative;
  z-index: 0;
  font-style: normal;
  font-weight: 400;
}

.hero h1 em::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -0.07em;
  bottom: 0.03em;
  left: -0.03em;
  height: 0.25em;
  border-radius: 99px;
  background: var(--lime);
  transform: rotate(-1.4deg);
}

.hero-copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.8;
}

.generator-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control-panel,
.result-panel {
  min-width: 0;
  padding: 38px 40px;
}

.control-panel {
  border-right: 1px solid var(--line);
}

.result-panel {
  display: flex;
  min-height: 650px;
  flex-direction: column;
  background:
    linear-gradient(rgba(23, 28, 43, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 28, 43, 0.025) 1px, transparent 1px),
    rgba(250, 249, 246, 0.66);
  background-size: 28px 28px;
}

.panel-heading,
.result-header,
.history-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-heading h2,
.result-header h2,
.history-heading h2 {
  margin: 7px 0 0;
  font-size: 1.48rem;
  letter-spacing: -0.04em;
}

.secure-random {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(200, 241, 53, 0.16);
  color: #607217;
  font-size: 0.65rem;
  letter-spacing: -0.01em;
}

.secure-random i {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.control-block {
  margin-top: 29px;
  padding-top: 27px;
  border-top: 1px solid var(--line);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.label-row h3 {
  margin: 0 0 6px;
  font-size: 0.94rem;
  letter-spacing: -0.025em;
}

.label-row h3 span {
  margin-left: 5px;
  color: #92969f;
  font-size: 0.68rem;
  font-weight: 600;
}

.label-row p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.stepper {
  display: grid;
  grid-template-columns: 42px 48px 42px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
}

.stepper button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1.2rem;
  transition: background 150ms ease, color 150ms ease;
}

.stepper button:hover:not(:disabled) {
  background: rgba(23, 28, 43, 0.05);
  color: var(--ink);
}

.stepper button:disabled {
  cursor: not-allowed;
  opacity: 0.28;
}

.stepper output {
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
}

.selection-count {
  min-width: 45px;
  color: #969aa3;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: right;
}

.selection-count strong {
  color: var(--purple);
  font-size: 1rem;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 7px;
  margin-top: 19px;
}

.number-choice {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid rgba(23, 28, 43, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: #555b68;
  cursor: pointer;
  font-size: 0.69rem;
  font-weight: 750;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.number-choice:hover:not(:disabled) {
  border-color: rgba(112, 88, 232, 0.45);
  transform: translateY(-2px);
}

.number-choice[aria-pressed="true"] {
  border-color: var(--purple);
  background: var(--purple);
  box-shadow: 0 5px 12px rgba(112, 88, 232, 0.25);
  color: #fff;
  transform: translateY(-2px);
}

.number-choice:disabled:not([aria-pressed="true"]) {
  cursor: not-allowed;
  opacity: 0.34;
}

.fixed-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
}

.fixed-actions p,
.result-footer p {
  margin: 0;
  color: #898d97;
  font-size: 0.7rem;
}

.fixed-actions p span {
  color: var(--purple);
}

.text-button {
  min-height: 36px;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: #656a78;
  cursor: pointer;
  font-size: 0.71rem;
  font-weight: 750;
}

.text-button:disabled {
  border-color: transparent;
  cursor: not-allowed;
  opacity: 0.35;
}

.text-button.danger {
  color: #b55050;
}

.generate-button {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr 30px;
  align-items: center;
  width: 100%;
  min-height: 76px;
  margin-top: 28px;
  padding: 12px 16px;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: var(--ink);
  box-shadow: 0 14px 24px rgba(23, 28, 43, 0.18);
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.generate-button::after {
  content: "";
  position: absolute;
  top: -30px;
  right: 12%;
  width: 74px;
  height: 140px;
  background: rgba(255, 255, 255, 0.055);
  transform: rotate(25deg);
}

.generate-button:hover {
  box-shadow: 0 18px 30px rgba(23, 28, 43, 0.24);
  transform: translateY(-2px);
}

.generate-button:active {
  transform: translateY(0) scale(0.99);
}

.button-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--lime);
  color: var(--ink);
}

.button-icon svg {
  width: 21px;
  fill: currentColor;
}

.generate-button strong,
.generate-button small {
  position: relative;
  z-index: 1;
  display: block;
}

.generate-button strong {
  font-size: 0.94rem;
}

.generate-button small {
  margin-top: 4px;
  color: #aeb1ba;
  font-size: 0.67rem;
}

.button-arrow {
  position: relative;
  z-index: 1;
  color: var(--lime);
  font-size: 1.4rem;
  text-align: center;
  transition: transform 160ms ease;
}

.generate-button:hover .button-arrow {
  transform: translateX(4px);
}

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

.icon-text-button,
.round-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 750;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.icon-text-button:hover,
.round-icon-button:hover {
  border-color: rgba(112, 88, 232, 0.3);
  background: #fff;
  color: var(--purple);
}

.icon-text-button {
  gap: 6px;
  padding: 0 12px;
  border-radius: 11px;
}

.round-icon-button {
  width: 40px;
  border-radius: 50%;
}

.icon-text-button svg,
.round-icon-button svg,
.copy-game svg {
  width: 16px;
  fill: currentColor;
}

.empty-state {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px 0 60px;
  text-align: center;
}

.empty-state h3 {
  margin: 27px 0 8px;
  font-size: 1.02rem;
  letter-spacing: -0.03em;
}

.empty-state p {
  margin: 0;
  color: #878b95;
  font-size: 0.76rem;
}

.lottery-machine {
  position: relative;
  width: 162px;
  height: 176px;
}

.machine-glass {
  position: absolute;
  top: 0;
  left: 15px;
  width: 132px;
  height: 132px;
  border: 3px solid var(--ink);
  border-radius: 49% 51% 47% 53%;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset -14px -14px 0 rgba(112, 88, 232, 0.06);
}

.machine-glass::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 20px;
  width: 11px;
  height: 25px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.75);
  transform: rotate(35deg);
}

.mini-ball {
  position: absolute;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: inset -4px -5px 0 rgba(0, 0, 0, 0.08);
  color: var(--ink);
  font-size: 0.61rem;
  font-weight: 900;
}

.mini-ball:nth-child(1) { left: 18px; bottom: 16px; transform: rotate(-10deg); }
.mini-ball:nth-child(2) { right: 19px; bottom: 18px; transform: rotate(8deg); }
.mini-ball:nth-child(3) { left: 47px; bottom: 43px; transform: rotate(9deg); }
.mini-ball:nth-child(4) { right: 38px; bottom: 2px; transform: rotate(-7deg); }

.spark {
  position: absolute;
  color: var(--purple);
  font-size: 0.8rem;
}

.spark-one { top: 24px; right: 25px; }
.spark-two { top: 46px; left: 31px; font-size: 0.48rem; }

.machine-neck {
  position: absolute;
  top: 124px;
  left: 57px;
  width: 48px;
  height: 22px;
  border-right: 3px solid var(--ink);
  border-left: 3px solid var(--ink);
  background: rgba(255, 255, 255, 0.75);
}

.machine-base {
  position: absolute;
  bottom: 0;
  left: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 86px;
  height: 36px;
  border: 3px solid var(--ink);
  border-radius: 10px 10px 5px 5px;
  background: var(--lime);
  transform: perspective(60px) rotateX(4deg);
}

.machine-base i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.ball-yellow { background: var(--yellow); }
.ball-blue { background: var(--blue); color: #fff; }
.ball-red { background: var(--red); color: #fff; }
.ball-gray { background: var(--gray); color: #fff; }
.ball-green { background: var(--green); color: #fff; }

.results {
  display: grid;
  gap: 11px;
  margin-top: 28px;
}

.game-row {
  display: grid;
  grid-template-columns: 31px 1fr 38px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 16px 13px;
  border: 1px solid rgba(23, 28, 43, 0.09);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 22px rgba(23, 28, 43, 0.045);
  animation: row-in 360ms both cubic-bezier(0.2, 0.72, 0.25, 1);
}

.game-label {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  background: #eeecf4;
  color: #737785;
  font-size: 0.69rem;
  font-weight: 900;
}

.balls {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.lotto-ball {
  position: relative;
  display: grid;
  width: clamp(37px, 4.15vw, 46px);
  height: clamp(37px, 4.15vw, 46px);
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid rgba(23, 28, 43, 0.76);
  border-radius: 50%;
  box-shadow: inset -5px -6px 0 rgba(0, 0, 0, 0.1), 0 3px 0 rgba(23, 28, 43, 0.12);
  font-size: clamp(0.72rem, 1.1vw, 0.84rem);
  font-weight: 900;
}

.lotto-ball::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 8px;
  width: 7px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.36);
  transform: rotate(-32deg);
}

.lotto-ball.fixed::before {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--purple);
}

.copy-game {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #979aa3;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.copy-game:hover {
  background: rgba(112, 88, 232, 0.08);
  color: var(--purple);
}

.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: auto;
  padding-top: 25px;
}

.result-footer p span {
  display: inline-grid;
  width: 18px;
  height: 18px;
  margin-right: 5px;
  place-items: center;
  border-radius: 50%;
  background: rgba(200, 241, 53, 0.5);
  color: #546512;
  font-size: 0.62rem;
  font-weight: 900;
}

.history-section {
  margin-top: 26px;
  padding: 30px 34px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.52);
  box-shadow: 0 14px 38px rgba(36, 39, 52, 0.055);
}

.history-list {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(125px, 0.28fr) 1fr 36px;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.75);
}

.history-meta strong,
.history-meta time {
  display: block;
}

.history-meta strong {
  font-size: 0.76rem;
}

.history-meta time {
  margin-top: 3px;
  color: #999ca4;
  font-size: 0.65rem;
}

.history-numbers {
  overflow: hidden;
  color: #5f6471;
  font-size: 0.72rem;
  line-height: 1.65;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-history-item {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #9b9ea6;
  cursor: pointer;
  font-size: 1rem;
}

.delete-history-item:hover {
  background: rgba(235, 100, 100, 0.1);
  color: #c15454;
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 34px 0 0;
  padding: 0 10px;
}

.info-strip p {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #777b86;
  font-size: 0.72rem;
}

.info-strip span {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(23, 28, 43, 0.06);
  color: var(--ink);
  font-weight: 900;
}

footer {
  padding: 70px 0 38px;
  color: #96989e;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}

footer span {
  margin: 0 6px;
  color: var(--lime-deep);
}

.toast {
  position: fixed;
  z-index: 10;
  right: 24px;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(100% - 48px);
  padding: 12px 17px;
  border-radius: 12px;
  background: var(--ink);
  box-shadow: 0 12px 32px rgba(23, 28, 43, 0.25);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

@keyframes row-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

:root[data-theme=dark] body {
  background:
    radial-gradient(circle at 20% 0%, rgba(208, 246, 75, 0.08), transparent 28rem),
    radial-gradient(circle at 100% 52%, rgba(169, 152, 255, 0.1), transparent 31rem),
    var(--paper);
}

:root[data-theme=dark] .theme-toggle { background: rgba(255, 255, 255, 0.09); color: #f4f1e9; }
:root[data-theme=dark] .theme-button-icon { color: #d0f64b; }
:root[data-theme=dark] .lotto-badge { background: rgba(255, 255, 255, 0.055); }
:root[data-theme=dark] .generator-shell { border-color: rgba(255, 255, 255, 0.08); }
:root[data-theme=dark] .result-panel {
  background:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    rgba(18, 21, 31, 0.42);
  background-size: 28px 28px;
}
:root[data-theme=dark] .secure-random { background: rgba(208, 246, 75, 0.1); color: #c3dd67; }
:root[data-theme=dark] .stepper,
:root[data-theme=dark] .number-choice,
:root[data-theme=dark] .icon-text-button,
:root[data-theme=dark] .round-icon-button { background: rgba(255, 255, 255, 0.055); }
:root[data-theme=dark] .number-choice { border-color: rgba(255, 255, 255, 0.1); color: #c5c8d1; }
:root[data-theme=dark] .number-choice[aria-pressed=true] { border-color: var(--purple); background: #7662e9; color: #fff; }
:root[data-theme=dark] .generate-button { background: #f1eee6; box-shadow: 0 16px 30px rgba(0, 0, 0, 0.3); color: #171c2b; }
:root[data-theme=dark] .generate-button small { color: #696d78; }
:root[data-theme=dark] .generate-button .button-arrow { color: #7058e8; }
:root[data-theme=dark] .machine-glass,
:root[data-theme=dark] .machine-neck { background: rgba(255, 255, 255, 0.04); }
:root[data-theme=dark] .game-row,
:root[data-theme=dark] .history-item {
  border-color: rgba(255, 255, 255, 0.075);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.12);
}
:root[data-theme=dark] .game-label,
:root[data-theme=dark] .info-strip span { background: rgba(255, 255, 255, 0.08); color: #b9bdc8; }
:root[data-theme=dark] .lotto-ball { border-color: rgba(245, 243, 236, 0.7); box-shadow: inset -5px -6px 0 rgba(0, 0, 0, 0.14), 0 3px 0 rgba(0, 0, 0, 0.28); }
:root[data-theme=dark] .ball-yellow { color: #171c2b; }
:root[data-theme=dark] .history-section { border-color: rgba(255, 255, 255, 0.07); background: rgba(255, 255, 255, 0.035); box-shadow: 0 14px 38px rgba(0, 0, 0, 0.14); }
:root[data-theme=dark] .toast { background: #f1eee6; color: #171c2b; }

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

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .result-panel {
    min-height: 570px;
  }

  .lotto-ball {
    width: clamp(40px, 7vw, 49px);
    height: clamp(40px, 7vw, 49px);
  }
}

@media (max-width: 680px) {
  .site-header,
  main,
  footer {
    width: min(100% - 28px, 560px);
  }

  .site-header {
    min-height: 70px;
  }

  .brand-name {
    font-size: 0.76rem;
  }

  .hero {
    padding: 45px 0 38px;
  }

  .hero h1 {
    margin-top: 15px;
    font-size: clamp(2.4rem, 12vw, 3.65rem);
  }

  .hero-copy {
    font-size: 0.88rem;
  }

  .desktop-break {
    display: none;
  }

  .generator-shell {
    border-radius: 24px;
  }

  .control-panel,
  .result-panel {
    padding: 28px 20px;
  }

  .result-panel {
    min-height: 510px;
  }

  .number-grid {
    gap: 6px;
  }

  .number-choice {
    font-size: 0.63rem;
  }

  .game-row {
    grid-template-columns: 24px minmax(0, 1fr) 32px;
    gap: 7px;
    padding: 14px 8px;
  }

  .game-label {
    width: 24px;
    height: 28px;
    border-radius: 7px;
    font-size: 0.62rem;
  }

  .balls {
    gap: 3px;
  }

  .lotto-ball {
    width: clamp(33px, 10.5vw, 43px);
    height: clamp(33px, 10.5vw, 43px);
    border-width: 1.5px;
    font-size: clamp(0.66rem, 3.1vw, 0.78rem);
  }

  .copy-game {
    width: 32px;
    height: 36px;
  }

  .result-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .history-section {
    padding: 25px 20px;
  }

  .history-item {
    grid-template-columns: 1fr 36px;
    gap: 8px;
  }

  .history-numbers {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .info-strip {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 4px;
  }

  footer {
    padding-top: 52px;
  }
}

@media (max-width: 390px) {
  .lotto-badge {
    padding: 8px 10px;
    font-size: 0.62rem;
  }

  .panel-heading h2,
  .result-header h2,
  .history-heading h2 {
    font-size: 1.28rem;
  }

  .control-panel,
  .result-panel {
    padding-inline: 15px;
  }

  .fixed-label-row {
    align-items: flex-end;
  }

  .number-grid {
    gap: 5px;
  }

  .number-choice {
    font-size: 0.59rem;
  }

  .generate-button {
    grid-template-columns: 42px 1fr 25px;
    padding-inline: 12px;
  }

  .game-row {
    grid-template-columns: 22px minmax(0, 1fr) 28px;
    gap: 4px;
    padding-inline: 6px;
  }

  .balls {
    gap: 2px;
  }

  .lotto-ball {
    width: clamp(31px, 9.55vw, 37px);
    height: clamp(31px, 9.55vw, 37px);
  }

  .copy-game {
    width: 28px;
  }

  .copy-game svg {
    width: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
