@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  font-size: 16px;
  --bg: #f4f5f8;
  --panel: #ffffff;
  --accent: #f05a28;
  --accent-dark: #c0451f;
  --text: #1f2330;
  --muted: #5c6070;
  --border: rgba(17, 24, 39, 0.1);
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page-header {
  padding: 3rem 5vw 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.page-header h1 {
  margin: 0.4rem 0 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.page-header .lede {
  max-width: 680px;
  margin-top: 0.8rem;
  color: var(--muted);
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5vw 3rem;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(520px, 2fr);
  gap: 2rem;
  align-items: stretch;
}

.panel,
.viewer {
  background: var(--panel);
  border-radius: 1.2rem;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.panel {
  max-width: 420px;
}

.viewer.viewer-fullscreen {
  position: relative;
  max-width: none;
  width: 100%;
  height: 100vh;
  border-radius: 0;
  padding: 1.5rem;
  box-shadow: none;
  z-index: 5;
  background: var(--panel);
}

.viewer.viewer-fullscreen #three-root {
  height: calc(100vh - 180px);
}

.summary-panel {
  max-width: none;
  grid-column: 1 / -1;
}

form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.field {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  justify-content: space-between;
}

label {
  font-weight: 500;
  font-size: 0.95rem;
  flex: 1 1 auto;
  margin: 0;
}

label span {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
}

input[type="number"] {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  flex: 0 0 110px;
  width: 110px;
  max-width: 110px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(240, 90, 40, 0.2);
}

.buttons {
  display: flex;
  gap: 0.75rem;
  grid-column: 1 / -1;
}

button {
  border: none;
  border-radius: 0.7rem;
  padding: 0.85rem 1.6rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:active {
  transform: translateY(1px);
}

button#calculate {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 15px 30px rgba(240, 90, 40, 0.25);
}

button#calculate:hover {
  background: var(--accent-dark);
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
}

.result-card {
  background: linear-gradient(135deg, rgba(240, 90, 40, 0.12), rgba(240, 90, 40, 0.05));
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.result-card.dual {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.result-block {
  flex: 1 1 220px;
  padding: 1rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px);
}

.result-block.insulation {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(14, 165, 233, 0.05));
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.total {
  font-size: 2.2rem;
  margin: 0.25rem 0 0;
  font-weight: 600;
}

.reserve {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.order-note {
  margin: 0.2rem 0 0;
  color: var(--accent-dark);
  font-size: 0.95rem;
  font-weight: 600;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.result-list li {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--muted);
}

.result-list strong {
  color: var(--text);
}

.note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.warning {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  color: #b45309;
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.4);
  border-radius: 0.6rem;
  padding: 0.6rem 0.75rem;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.viewer-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(240, 90, 40, 0.08);
  color: var(--accent);
}

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

.icon-btn .icon svg {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.viewer-header h2 {
  margin: 0.35rem 0 0;
}

#three-root {
  margin-top: 1.5rem;
  border-radius: 1rem;
  overflow: hidden;
  height: 420px;
  background: #e6eaef;
  position: relative;
}

.tips {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.page-footer {
  max-width: 1200px;
  margin: 0 auto 3rem;
  padding: 0 5vw;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .buttons {
    flex-direction: column;
  }

  .viewer-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .field {
    flex-direction: column;
    align-items: stretch;
  }

  label,
  input[type="number"] {
    width: 100%;
    flex: 1 0 100%;
  }

  #three-root {
    height: 300px;
  }
}
