html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  background: #f3f5f8;
  color: #1f2937;
}

* {
  box-sizing: border-box;
}

body {
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

#app {
  min-height: 100vh;
}

.page-shell {
  max-width: 980px;
  margin: 0 auto;
  background: #f8fafc;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 28px;
  background: #1f2b3a;
  color: #fff;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.al-badge {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.18);
  color: #ffb703;
  font-weight: 900;
  font-size: 24px;
  background: rgba(255,255,255,0.02);
}

.topbar-copy h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.topbar-copy p {
  margin: 2px 0 0;
  color: #d7dde6;
  font-size: 14px;
}

.density-box {
  text-align: right;
  color: #ffb703;
}

.density-box span {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.density-box strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.shape-area {
  padding: 18px 28px 0;
}

.section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
  color: #334155;
}

.shape-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.shape-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 74px;
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #1f2937;
  cursor: pointer;
}

.shape-card.is-active {
  border: 2px solid #ffb703;
  background: #fff8e1;
  color: #b46900;
  font-weight: 800;
}

.shape-card.is-disabled {
  color: #94a3b8;
  background: #f8fafc;
  cursor: not-allowed;
}

.shape-symbol {
  font-size: 16px;
  font-weight: 800;
}

.shape-label {
  font-size: 14px;
  font-weight: 700;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 344px;
  gap: 18px;
  padding: 18px 28px 28px;
  align-items: start;
}

.calc-panel,
.result-panel {
  position: relative;
}

.calc-panel {
  background: #fff;
  border: 1px solid #a8b0ba;
  padding: 24px 24px 20px;
}

.result-panel {
  background: #1f2b3a;
  color: #fff;
  padding: 24px;
}

.panel-marker {
  position: absolute;
  top: 20px;
  left: 24px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: #ffb703;
  color: #111827;
}

.calc-panel-head,
.result-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-left: 50px;
}

.calc-panel-head h2,
.result-panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.link-button {
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 18px;
  margin-top: 18px;
}

.metric-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-label {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.metric-input-wrap {
  display: grid;
  grid-template-columns: 1fr 46px;
  align-items: stretch;
}

.metric-input-wrap input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #9ca3af;
  background: #fff;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 800;
  text-align: right;
}

.metric-input-wrap em {
  min-height: 44px;
  display: grid;
  place-items: center;
  background: #eef2f7;
  color: #475569;
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
}

.formula-hint {
  margin-top: 26px;
  padding: 14px 16px;
  background: #f1f5f9;
  color: #64748b;
}

.formula-hint span {
  display: inline-block;
  margin-right: 12px;
  color: #1e293b;
  font-weight: 700;
}

.formula-hint strong {
  font-weight: 500;
  font-size: 14px;
}

.result-hero {
  margin-top: 18px;
  padding: 14px 18px 22px;
  background: #16202d;
  border-top: 3px solid #ffb703;
}

.result-hero p,
.result-total p,
.extension-box p,
.result-info-box span,
.result-footnote span {
  margin: 0 0 10px;
  color: #cbd5e1;
}

.result-hero-row,
.result-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.result-hero-row strong,
.result-total-row strong {
  font-size: 40px;
  line-height: 1;
  font-weight: 900;
  color: #ffb703;
}

.result-hero-row span,
.result-total-row span {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.result-meta {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.meta-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  color: #d7dde6;
}

.meta-row strong {
  color: #fff;
  font-size: 24px;
}

.result-total {
  border: 1px solid rgba(255,255,255,0.24);
  padding: 16px 18px;
}

.result-total small {
  display: block;
  margin-top: 12px;
  color: #cbd5e1;
}

.result-footnote,
.result-info-box,
.extension-box,
.result-empty {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.05);
}

.result-footnote strong,
.result-info-box strong,
.extension-box h3,
.result-empty strong {
  display: block;
  margin: 0;
}

.result-info-box strong,
.extension-box h3,
.result-empty strong,
.extension-box p,
.result-empty span,
.result-footnote strong {
  color: #fff;
}

.result-empty--error {
  border: 1px solid rgba(255, 183, 3, 0.35);
}

.extension-title {
  color: #ffb703 !important;
  font-weight: 800;
}

.disabled-button {
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.12);
  color: #cbd5e1;
  cursor: not-allowed;
}

@media (max-width: 920px) {
  .shape-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 16px;
  }

  .shape-area,
  .tool-grid {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar-left {
    gap: 14px;
  }

  .tool-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .result-hero-row strong,
  .result-total-row strong {
    font-size: 34px;
  }
}
