:root {
  color-scheme: dark;
  --page: #07101d;
  --panel: #0e1a2e;
  --panel-strong: #13223a;
  --line: #263a58;
  --text: #f8fafc;
  --muted: #a9b7cb;
  --accent: #2dd4bf;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: transparent;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button {
  font: inherit;
}

.widget-shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, #183455 0, transparent 34%),
    var(--page);
  box-shadow: 0 20px 50px rgb(0 0 0 / 28%);
}

.widget-header {
  margin-bottom: 20px;
}

.widget-header h1 {
  margin: 4px 0 8px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.widget-header p {
  margin: 0;
  color: var(--muted);
}

.widget-header .eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.counter-stack {
  display: grid;
  gap: 16px;
}

.counter-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--panel-strong), var(--panel));
}

.counter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.counter-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

.counter-heading output {
  flex: none;
  padding: 7px 11px;
  border-radius: 999px;
  background: #07101d;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 8px;
}

.meal-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #46607e;
  border-radius: 50%;
  background: #0b1728;
  color: #d9e3f0;
  cursor: pointer;
  line-height: 1;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.meal-button span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}

.meal-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.meal-button:focus-visible {
  outline: 3px solid #5eead4;
  outline-offset: 2px;
}

.meal-button.selected {
  border-color: #fff;
  background: #fff;
  color: #000;
  font-weight: 800;
}

.totals-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #091525;
}

.totals-panel h2 {
  margin: 0 0 12px;
}

.totals-panel dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.totals-panel dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #12223a;
}

.totals-panel dt {
  color: var(--muted);
}

.totals-panel dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.validation {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
}

.validation.valid {
  border: 1px solid #0d9488;
  background: #063d3a;
  color: #ccfbf1;
}

.validation.invalid {
  border: 1px solid #be123c;
  background: #4c1024;
  color: #ffe4e6;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.actions button {
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #14243c;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 640px) {
  .widget-shell {
    padding: 14px;
    border-radius: 16px;
  }

  .counter-card {
    padding: 14px;
  }

  .totals-panel dl {
    grid-template-columns: 1fr;
  }
}
