* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #2a5a40;
  background-image:
    radial-gradient(ellipse at 30% 20%, #356e4e 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, #1e4a33 0%, transparent 60%);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 32px 16px;
}

/* ── Main layout ── */

#app {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  max-width: 1100px;
  width: 100%;
}

/* ── Calculator instance ── */

.calculator {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
}

/* ── Panels ── */

.panel {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(4px);
}

.panel-label {
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0 4px 2px;
  user-select: none;
}

/* ── Vul + Contract column ── */

.vul-contract-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Vul toggle ── */

.panel-vul {
  justify-content: center;
  align-items: center;
  padding: 12px 16px;
}

.vul-toggle {
  width: 100%;
  min-width: 200px;
  height: 48px;
  padding: 0 24px;
  text-align: center;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: #1a1a1a;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s, transform 0.1s, color 0.15s;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.15),
    0 1px 1px rgba(0, 0, 0, 0.08);
}

.vul-toggle:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.vul-toggle:active {
  transform: scale(0.95);
}

.vul-toggle.active {
  background: #c0392b;
  color: #fff;
  border-color: #a93226;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ── Contract panel ── */

.panel-contract {
  flex: 1;
}

.panel-contract .row {
  flex-wrap: nowrap;
}

.double-row {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.double-row .btn {
  min-width: 56px;
  height: 52px;
  font-size: 20px;
  font-weight: 700;
}

/* ── Tricks panel ── */

.panel-tricks {
  flex: 0 1 auto;
}

.tricks-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tricks-section {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.tricks-common {
  flex-wrap: nowrap;
}

.tricks-common .btn {
  min-width: 48px;
  height: 44px;
  font-size: 17px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 12px;
}

.tricks-far .btn {
  min-width: 36px;
  height: 32px;
  font-size: 13px;
  padding: 0 4px;
  border-radius: 9px;
}

/* Disabled buttons */
.btn.disabled {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

/* ── Result column ── */

.result-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 180px;
  flex: 1 0 180px;
}

.panel-result,
.panel-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-result {
  padding: 12px 16px 14px;
  gap: 4px;
}

.panel-score {
  padding: 16px 16px 20px;
  gap: 4px;
  flex: 1;
}

.contract-text {
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  min-height: 28px;
}

.score-text {
  color: #fff;
  font-family: 'Fraunces', serif;
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  transition: color 0.2s;
}

.score-text.negative {
  color: #ff6b5a;
}

/* ── Rows ── */

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

/* ── Buttons ── */

.btn {
  min-width: 48px;
  height: 48px;
  padding: 0 10px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: #1a1a1a;
  font-family: 'DM Sans', sans-serif;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.15),
    0 1px 1px rgba(0, 0, 0, 0.08);
  transition: background 0.12s, transform 0.1s, box-shadow 0.12s;
  user-select: none;
  white-space: nowrap;
}

.btn:hover {
  background: #fff;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn:active {
  transform: scale(0.95);
}

.btn.selected {
  background: #eab830;
  color: #1a1a1a;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ── Suit colors ── */

.btn.suit-c, .btn.suit-s {
  color: #1a1a1a;
}

.btn.suit-d {
  color: #d14a00;
}

.btn.suit-h {
  color: #c41e1e;
}

.btn.suit-nt {
  color: #1a1a1a;
}

.btn.suit-d.selected {
  color: #9a3600;
}

.btn.suit-h.selected {
  color: #8e1616;
}

/* ── Calculator separator ── */

.calculator-separator {
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  margin: 4px 0;
}

/* ── Compare button ── */

.compare-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px 12px 22px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 28px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.compare-btn .icon {
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.compare-btn:hover {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.5);
}

.compare-btn.active {
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.2);
  border-style: solid;
}

.compare-btn.active:hover {
  color: rgba(255, 200, 200, 0.8);
  border-color: rgba(255, 200, 200, 0.4);
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .calculator {
    flex-wrap: wrap;
    justify-content: center;
  }

  .panel {
    flex: 0 0 auto;
  }

  .result-column {
    width: 100%;
    flex-direction: row;
    min-width: 0;
  }

  .panel-result,
  .panel-score {
    flex: 1;
  }

  .score-text {
    font-size: 48px;
  }
}

@media (max-width: 420px) {
  body {
    padding: 16px 8px;
  }

  .btn {
    min-width: 40px;
    height: 40px;
    font-size: 15px;
    padding: 0 8px;
    border-radius: 10px;
  }

  .tricks-common .btn {
    min-width: 40px;
    height: 38px;
    font-size: 15px;
  }

  .tricks-far .btn {
    min-width: 30px;
    height: 28px;
    font-size: 11px;
  }

  .vul-toggle {
    height: 40px;
    font-size: 11px;
  }

  .score-text {
    font-size: 40px;
  }

  .contract-text {
    font-size: 15px;
  }
}
