:root {
  --bg-body: #f4f6fb;
  --bg-card: #ffffff;
  --bg-muted: #f9fafc;
  --border-soft: #e2e6f0;
  --border-strong: #d3d9e6;
  --text-primary: #1f2430;
  --text-muted: #616877;
  --brand: #a31919;
  --brand-dark: #7c0f0f;
  --success: #12b76a;
  --warning: #f7b500;
  --shadow-soft: 0 10px 30px rgba(31, 36, 48, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', 'Arial', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
}

p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

a {
  color: var(--brand);
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

#calculator {
  width: min(1200px, calc(100% - 32px));
  margin: 110px auto 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: var(--shadow-soft);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.page-intro {
  max-width: 720px;
}

.page-intro .eyebrow {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.page-intro h1 {
  font-size: clamp(1.8rem, 2.6vw, 2.6rem);
  margin-bottom: 0.5rem;
}

.page-intro .subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

.page-meta {
  text-align: right;
  min-width: 200px;
}

.page-meta .tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
  background: rgba(163, 25, 25, 0.08);
  margin-bottom: 0.75rem;
}

.page-meta .meta-note {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-soft);
}

.tabs-card {
  padding: 16px 24px;
}

.tabs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  cursor: pointer;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: all 0.25s ease;
  color: var(--text-muted);
  background: var(--bg-muted);
  white-space: nowrap;
}

.tab:hover {
  border-color: var(--border-strong);
}

.tab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 10px 20px rgba(163, 25, 25, 0.25);
}

.tab-content {
  display: none;
  padding: 32px 28px;
  border-radius: 20px;
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
}

.tab-content.active {
  display: block;
}

.notice-card {
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 24px;
  background: rgba(163, 25, 25, 0.08);
  border: 1px solid rgba(163, 25, 25, 0.2);
}

.notice-card p {
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.category {
  background: var(--bg-muted);
  border-radius: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category h2 {
  font-size: 1.05rem;
  color: var(--text-primary);
}

.category select,
.category input[type="number"] {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  padding: 0 12px;
  font-size: 1rem;
  background: #fff;
  color: var(--text-primary);
}

.field-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.radio {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
}

.radio input {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: border 0.2s ease, background 0.2s ease;
}

.radio input::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  transform: scale(0);
  transition: transform 0.2s ease;
}

.radio input:checked {
  border-color: var(--brand);
  background: rgba(163, 25, 25, 0.1);
}

.radio input:checked::before {
  transform: scale(1);
}

.radio span {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.summary-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.summary-card {
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-card.success {
  background: var(--success);
}

.summary-card.warning {
  background: #f57c00;
}

.summary-card .primary-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.summary-card .meta {
  font-size: 0.95rem;
  opacity: 0.85;
}

.highlight-note {
  background: #fff3cd;
  color: #7a6200;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.secondary-meta {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.9rem;
}

.discord-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.discord-panel h3 {
  font-size: 1.2rem;
}

.input-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-stack input,
.input-stack select {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  padding: 0 14px;
  font-size: 1rem;
  background: var(--bg-muted);
}

.btn-send {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: #5865f2;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-send:hover {
  background: #4752c4;
  transform: translateY(-1px);
}

.btn-send:disabled {
  background: #c5c9d6;
  cursor: not-allowed;
  transform: none;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 27, 0.85);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 32px;
  width: min(420px, 100%);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.login-card h2 {
  margin-bottom: 0.75rem;
}

#menu__toggle {
  opacity: 0;
}

#menu__toggle:checked + .menu__btn > span {
  transform: rotate(45deg);
}

#menu__toggle:checked + .menu__btn > span::before {
  top: 0;
  transform: rotate(0deg);
}

#menu__toggle:checked + .menu__btn > span::after {
  top: 0;
  transform: rotate(90deg);
}

#menu__toggle:checked ~ .menu__box {
  right: 0 !important;
}

.menu__btn {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  z-index: 10001;
  background: var(--bg-card);
  border-radius: 50%;
  box-shadow: var(--shadow-soft);
  display: grid;
  place-items: center;
}

.menu__btn > span,
.menu__btn > span::before,
.menu__btn > span::after {
  display: block;
  position: absolute;
  width: 18px;
  height: 2px;
  background-color: var(--text-primary);
  transition-duration: 0.25s;
}

.menu__btn > span::before {
  content: '';
  top: -6px;
}

.menu__btn > span::after {
  content: '';
  top: 6px;
}

.menu__box {
  position: fixed;
  top: 0;
  right: -100%;
  width: 300px;
  height: 100%;
  margin: 0;
  padding: 90px 0;
  list-style: none;
  background-color: #ffffff;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.25);
  transition-duration: 0.25s;
  z-index: 10000;
}

.menu__item {
  display: block;
  padding: 14px 28px;
  color: var(--text-primary) !important;
  font-size: 1.05rem;
  font-weight: 600;
}

.menu__item:hover {
  background-color: var(--bg-muted);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
}

.loading-overlay.active {
  display: flex !important;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--brand);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.info-card {
  background: rgba(15, 23, 42, 0.04);
  border: 1px dashed var(--border-strong);
  padding: 16px 20px;
  border-radius: 16px;
}

.info-card strong {
  color: var(--text-primary);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.sr-only.capture-visible {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  border: none;
}

@media (max-width: 1024px) {
  #calculator {
    width: calc(100% - 32px);
    margin: 100px auto 48px;
  }

  .page-header {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  #calculator {
    margin-top: 80px;
    width: calc(100% - 24px);
  }

  .page-meta {
    text-align: left;
  }

  .tab-content {
    padding: 24px 20px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 18px;
  }

  .category {
    padding: 16px;
  }

  .menu__btn {
    top: 16px;
    right: 16px;
  }
}