:root {
  --bg: #0f2228;
  --bg-soft: #17343c;
  --card: #1c3f48;
  --line: rgba(255, 255, 255, 0.14);
  --text: #f4fbfc;
  --muted: #b4cfd6;
  --plus: #35d9a5;
  --minus: #ff7d7d;
  --warn: #ffb35a;
  --radius: 0.75rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Avenir Next", "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(165deg, var(--bg), var(--bg-soft));
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 0.36rem;
  padding: calc(env(safe-area-inset-top) + 0.5rem) 0.5rem calc(env(safe-area-inset-bottom) + 0.5rem);
}

.brand {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.12rem;
}

.brand-main {
  margin: 0;
  font-size: clamp(1rem, 3.2vw, 1.28rem);
  line-height: 1;
  letter-spacing: 0.01em;
  font-weight: 850;
  text-align: center;
}

.brand-sub {
  opacity: 0.72;
  font-size: 0.84em;
  font-weight: 650;
}

.top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.total-card,
.change-card,
.row {
  background: rgba(15, 40, 48, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.total-card,
.change-card {
  padding: 0.58rem 0.68rem;
}

.total-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100%;
}

.label {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.78rem, 2.2vw, 1rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
}

.total {
  margin: 0.2rem 0 0;
  font-size: clamp(2rem, 8.2vw, 3.8rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.02em;
  width: 100%;
  text-align: center;
  align-self: center;
}

.hints {
  margin-top: 0.3rem;
  display: grid;
  gap: 0.22rem;
  font-size: clamp(0.95rem, 3.6vw, 1.45rem);
  font-weight: 500;
  line-height: 1.05;
}

.hints > div {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 0.45rem;
  padding: 0.18rem 0.34rem;
}

.hints strong {
  font-weight: 900;
}

.rows {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 0.38rem;
}

.row {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10.8rem, 52vw);
  gap: 0.4rem;
  align-items: center;
  padding: 0.4rem;
}

.item {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.item h2 {
  margin: 0;
  font-size: clamp(1.25rem, 4.8vw, 1.95rem);
  font-weight: 850;
  line-height: 0.98;
}

.meta {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: clamp(1rem, 3.3vw, 1.35rem);
  font-weight: 700;
  line-height: 1.1;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  height: 100%;
  align-self: stretch;
}

.action {
  border: 0;
  border-radius: 0.56rem;
  color: #072417;
  font-size: clamp(1.28rem, 5.1vw, 1.75rem);
  font-weight: 800;
  min-height: 0;
  height: 100%;
  line-height: 1;
}

.action.plus {
  background: linear-gradient(135deg, #79f7d0, var(--plus));
}

.action.minus {
  background: linear-gradient(135deg, #ffc0c0, var(--minus));
}

.action.with-indicator {
  position: relative;
  overflow: hidden;
}

.btn-symbol {
  position: absolute;
  top: 0.22rem;
  left: 0.32rem;
  font-size: clamp(0.82rem, 2.9vw, 1rem);
  line-height: 1;
  z-index: 2;
}

.minus-symbol {
  left: auto;
  right: 0.32rem;
}

.btn-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 11vw, 4.4rem);
  font-weight: 800;
  color: rgba(7, 36, 23, 0.4);
  line-height: 0.85;
  z-index: 1;
  pointer-events: none;
}

.btn-count-minus {
  color: rgba(63, 8, 8, 0.4);
}

.bottom {
  display: block;
}

.reset-btn {
  width: 100%;
  border: 0;
  border-radius: 0.7rem;
  min-height: 2.8rem;
  background: linear-gradient(135deg, #ffd29a, var(--warn));
  color: #2f1800;
  font-size: clamp(0.9rem, 3.2vw, 1rem);
  font-weight: 800;
}

@media (min-width: 768px) {
  .app {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
    gap: 0.44rem;
  }

  .total-card,
  .change-card {
    padding: 0.64rem 0.76rem;
  }

  .row {
    grid-template-columns: minmax(0, 1fr) minmax(12.8rem, 43vw);
    padding: 0.46rem;
  }

  .reset-btn {
    min-height: 3.2rem;
  }
}
