:root {
  --bg-main: #f8f9fa;
  --bg-card: #ffffff;
  --bg-soft: #f1f3f5;
  --text-primary: #111111;
  --text-muted: #868e96;
  --border-strong: #111111;
  --border-light: #e9ecef;
  --brand-orange: #ff7f00;
  --brand-orange-hover: #e06d00;
  --pro-green: #12b886;
  --banner-pass-bg: #8ce99a;
  --banner-fail-bg: #ffc9c9;
  --banner-text: #0b2e13;
  --focus-ring: rgba(255, 127, 0, 0.25);
  --card-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

html:not(.dark) {
  color-scheme: light !important;
}

html.dark {
  color-scheme: dark !important;
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-soft: #334155;
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --border-strong: #475569;
  --border-light: #334155;
  --banner-pass-bg: #15803d;
  --banner-fail-bg: #b91c1c;
  --banner-text: #ffffff;
  --focus-ring: rgba(255, 127, 0, 0.4);
  --card-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: 'Pretendard', 'Malgun Gothic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* ===================================================
   TOP HEADER (heat.iskorea.org style)
   =================================================== */
.top-header {
  background-color: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

/* 로고 이미지 지원 스타일 (기존 파란색 로고 유지) */
.app-logo-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  flex-shrink: 0;
}

.app-logo-box img, .app-logo-box svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.3px;
  margin: 0;
}

.brand-text .title-full {
  display: inline;
}

.brand-text .title-short {
  display: none;
}

/* ===================================================
   COMPACT HEADER BADGES (Version, Pro & Offline)
   =================================================== */
/* Unified Header Controls: Version Badge (Left of Pro, Matching Theme & Help style) */
.hdr-btn-ver,
.version-badge {
  height: 38px;
  min-width: 38px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-soft);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  line-height: 1;
  transition: all 0.15s ease;
}

.hdr-btn-ver:hover,
.version-badge:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Unified Header Controls: Pro & WiFi (Matching Theme & Help button style) */
.hdr-btn-pro,
.pro-badge-compact {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-soft);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1;
}

.hdr-btn-pro:hover,
.pro-badge-compact:hover {
  transform: translateY(-1px);
  border-color: #10b981;
  background-color: rgba(16, 185, 129, 0.08);
}

.hdr-btn-pro.is-pro,
.pro-badge-compact.is-pro {
  color: #059669;
  border-color: rgba(16, 185, 129, 0.45);
  background-color: var(--bg-soft);
}

.hdr-btn-net,
.net-badge-compact {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: default;
  transition: all 0.15s ease;
  line-height: 1;
}

.hdr-btn-net .wifi-svg {
  width: 20px;
  height: 20px;
  color: #4686b8; /* Exact blue from uploaded WiFi icon */
  transition: all 0.2s ease;
}

.hdr-btn-net:hover,
.net-badge-compact:hover {
  border-color: #4686b8;
  transform: translateY(-1px);
}

.hdr-btn-net.offline .wifi-svg {
  color: var(--text-muted);
  opacity: 0.4;
}

html.dark .hdr-btn-pro,
html.dark .pro-badge-compact {
  background-color: var(--bg-soft);
  color: var(--text-muted);
  border-color: var(--border-light);
}

html.dark .hdr-btn-pro.is-pro,
html.dark .pro-badge-compact.is-pro {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.45);
  background-color: var(--bg-soft);
}

html.dark .hdr-btn-pro:hover,
html.dark .pro-badge-compact:hover {
  border-color: #34d399;
  background-color: rgba(52, 211, 153, 0.12);
}

html.dark .hdr-btn-net,
html.dark .net-badge-compact {
  background-color: var(--bg-soft);
  border-color: var(--border-light);
}

html.dark .hdr-btn-net .wifi-svg {
  color: #60a5fa;
}

html.dark .hdr-btn-net:hover,
html.dark .net-badge-compact:hover {
  border-color: #60a5fa;
}

html.dark .hdr-btn-ver,
html.dark .version-badge {
  background-color: var(--bg-soft);
  color: var(--text-muted);
  border-color: var(--border-light);
}

html.dark .hdr-btn-ver:hover,
html.dark .version-badge:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hdr-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-soft);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.hdr-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

/* ===================================================
   CIRCULAR FLAG LANGUAGE SELECTOR (Space-saving)
   =================================================== */
.lang-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-btn {
  height: 38px;
  padding: 0 8px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-soft);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.lang-btn:hover {
  border-color: #2563eb;
  background-color: var(--bg-card);
}

.flag-icon-circle {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.flag-svg,
.flag-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.lang-caret {
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.lang-btn.open .lang-caret {
  transform: rotate(180deg);
}

/* Dropdown Menu Popover */
.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 154px;
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 1000;
  animation: langFadeIn 0.15s ease-out;
}

@keyframes langFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
}

.lang-item:hover {
  background-color: var(--bg-soft);
  color: #2563eb;
}

.lang-item.active {
  background-color: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  font-weight: 800;
}

.lang-name {
  flex: 1;
  white-space: nowrap;
}

.lang-code {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-muted);
  background-color: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

.lang-item.active .lang-code {
  color: #2563eb;
  background-color: #fff;
}

html.dark .lang-dropdown-menu {
  background-color: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

html.dark .lang-item.active {
  background-color: rgba(37, 99, 235, 0.22);
}

html.dark .lang-item.active .lang-code {
  background-color: #0f172a;
}

/* 상단 수평선: 기존 파란색(#2563eb) 유지 */
.blue-divider, .orange-divider {
  height: 3px;
  background-color: #2563eb;
  width: 100%;
}

/* ===================================================
   MAIN CONTAINER & GRID SYSTEM
   =================================================== */
.main-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 100%;
}

.two-col-grid > * {
  min-width: 0; /* CRITICAL: prevents blowout of grid tracks */
}

@media (min-width: 1024px) {
  .two-col-grid {
    grid-template-columns: minmax(420px, 470px) minmax(0, 1fr);
    align-items: start;
    gap: 24px;
  }
}

.col-left, .col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  width: 100%;
}

/* OUTLINE CARDS (Matching heat.iskorea.org) */
.outline-card {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--card-shadow);
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  background-color: var(--bg-soft);
  color: var(--brand-orange);
  border: 1px solid var(--border-light);
}

/* ===================================================
   MATERIAL SELECTION (2x2 Grid)
   =================================================== */
.material-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.material-card {
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 12px 14px;
  background-color: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.material-card:hover {
  border-color: var(--brand-orange);
  background-color: var(--bg-soft);
}

.material-card.active {
  border-color: var(--brand-orange);
  background-color: var(--bg-soft);
  box-shadow: 0 0 0 2px var(--brand-orange);
}

.mat-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  min-width: 0;
}

.mat-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.mat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mat-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
}

.mat-default-tag {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}

.mat-density {
  font-size: 13px;
  font-weight: 800;
  color: var(--brand-orange);
  margin-bottom: 2px;
  white-space: nowrap;
}

.mat-std {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================================================
   SHAPE SELECTION (3x3 Grid)
   =================================================== */
/* ===================================================
   SHAPE SELECTION (Dropdown Selector)
   =================================================== */
.shape-dropdown-wrap {
  position: relative;
  width: 100%;
}

.shape-dropdown-select {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border-light);
  background-color: var(--bg-soft);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ff7f00' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.shape-dropdown-select:hover {
  border-color: var(--brand-orange);
}

.shape-dropdown-select:focus {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background-color: var(--bg-card);
}

html.dark .shape-dropdown-select {
  background-color: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

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

.shape-btn {
  height: 44px;
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shape-btn:hover {
  border-color: var(--brand-orange);
  background-color: var(--bg-soft);
}

.shape-btn.active {
  background-color: var(--brand-orange);
  border-color: var(--brand-orange);
  color: #ffffff;
}

/* ===================================================
   DIMENSION INPUTS & DIAGRAM WRAPPER
   =================================================== */
.dim-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.diagram-box {
  width: 100%;
  min-height: 190px;
  border: 1px dashed var(--border-light);
  border-radius: 12px;
  background-color: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 20px;
  box-sizing: border-box;
}

.shape-svg {
  max-width: 250px;
  max-height: 155px;
  width: 100%;
  height: auto;
  overflow: visible;
}

.dim-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.full-col {
  grid-column: span 2;
}

.field-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

/* STEPPER BOX (heat.iskorea.org style) */
.stepper-box {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background-color: var(--bg-card);
}

.stepper-box:focus-within {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.stepper-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stepper-info input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 800;
  outline: none;
}

.stepper-btns {
  display: flex;
  gap: 4px;
}

.step-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background-color: var(--bg-soft);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.step-btn:hover {
  background-color: var(--brand-orange);
  color: #fff;
}

/* DUAL UNIT INPUT (M ⇄ mm) */
.dual-unit-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.unit-field {
  position: relative;
  display: flex;
  align-items: center;
}

.unit-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 800;
  padding: 0 34px 0 12px;
  outline: none;
  text-align: right;
  transition: all 0.15s;
}

.unit-input:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.unit-tag {
  position: absolute;
  right: 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  pointer-events: none;
}

/* Length Warning Box & Quick Conversion */
.length-warn-box {
  margin-top: 8px;
  padding: 10px 14px;
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12.5px;
  color: #92400e;
  line-height: 1.45;
  transition: all 0.2s ease;
}

html.dark .length-warn-box {
  background-color: #451a03;
  border-color: #78350f;
  color: #fef3c7;
}

.length-warn-box.hidden {
  display: none !important;
}

.length-warn-content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.length-warn-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1.2;
}

.length-warn-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.btn-convert-length {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #f59e0b;
  background-color: #f59e0b;
  color: #ffffff;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.25);
}

.btn-convert-length:hover {
  background-color: #d97706;
  border-color: #d97706;
  transform: translateY(-1px);
}

/* ===================================================
   RESULT CARD (3-Stack big numbers)
   =================================================== */
.results-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.res-banner {
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 16px 20px;
  background-color: var(--bg-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.res-banner.primary {
  border-color: var(--brand-orange);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-soft) 100%);
}

.res-label-wrap {
  display: flex;
  flex-direction: column;
}

.res-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.res-val {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.res-val.orange {
  color: var(--brand-orange);
}

.res-val.green {
  color: var(--pro-green);
}

.res-val.blue {
  color: #0284c7;
}

.action-bar {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.action-btn {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}

.action-btn.btn-save {
  background-color: var(--brand-orange);
  color: #fff;
}

.action-btn.btn-save:hover {
  background-color: var(--brand-orange-hover);
}

/* ===================================================
   LIFTING & GEAR SELECTION SECTION
   =================================================== */
.angle-toggle-group {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.angle-btn {
  height: 38px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background-color: var(--bg-soft);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.angle-btn:hover {
  border-color: var(--brand-orange);
}

.angle-btn.active {
  background-color: var(--brand-orange);
  border-color: var(--brand-orange);
  color: #fff;
}

.angle-warn-box {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.angle-warn-box.ok {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.angle-warn-box.warn {
  background-color: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.angle-warn-box.danger {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

html.dark .angle-warn-box.ok { background-color: #064e3b; color: #6ee7b7; border-color: #047857; }
html.dark .angle-warn-box.warn { background-color: #7c2d12; color: #fdba74; border-color: #c2410c; }
html.dark .angle-warn-box.danger { background-color: #7f1d1d; color: #fca5a5; border-color: #991b1b; }

.gear-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gear-card {
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  padding: 14px;
  background-color: var(--bg-soft);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.gear-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gear-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.gear-sf {
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  background-color: var(--bg-card);
  color: var(--brand-orange);
  border: 1px solid var(--border-light);
}

.gear-val {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.2;
}

.gear-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.gear-swl {
  font-weight: 700;
  color: var(--brand-orange);
}

/* CRANE SELECTION */
.crane-toggle-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.crane-btn {
  height: 40px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background-color: var(--bg-soft);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.crane-btn:hover {
  border-color: var(--brand-orange);
}

.crane-btn.active {
  background-color: var(--brand-orange);
  border-color: var(--brand-orange);
  color: #fff;
}

.crane-result-box {
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  padding: 14px 18px;
  background-color: var(--bg-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===================================================
   SAVED RECORDS TABLE & MODAL
   =================================================== */
.records-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.rec-actions {
  display: flex;
  gap: 8px;
}

.rec-btn {
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rec-btn.save {
  background-color: var(--brand-orange);
  color: #fff;
  transition: background-color 0.2s ease;
}

.rec-btn.save:hover {
  background-color: var(--brand-orange-hover);
}

.rec-btn.export {
  background-color: var(--pro-green);
  color: #fff;
}

.rec-btn.delete {
  background-color: #ef4444;
  color: #fff;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.records-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.records-table th {
  background-color: var(--bg-soft);
  padding: 10px 14px;
  font-weight: 800;
  border-bottom: 1.5px solid var(--border-light);
  white-space: nowrap;
}

.records-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.records-table tr:hover {
  background-color: var(--bg-soft);
  cursor: pointer;
}

.empty-records {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.rec-action-cell {
  text-align: center;
  white-space: nowrap;
}

.tbl-btn {
  border: 1px solid var(--border-light);
  background: var(--bg-soft);
  color: var(--text-dark);
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  margin: 0 2px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tbl-btn:hover {
  background: var(--brand-orange);
  color: #fff;
  border-color: var(--brand-orange);
  transform: translateY(-1px);
}

.tbl-btn.edit {
  color: #2563eb;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.tbl-btn.edit:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.tbl-btn.del {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.tbl-btn.del:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

html.dark .tbl-btn.edit {
  background: #1e3a8a;
  color: #93c5fd;
  border-color: #1d4ed8;
}

html.dark .tbl-btn.del {
  background: #7f1d1d;
  color: #fca5a5;
  border-color: #991b1b;
}

/* ===================================================
   MODALS (Matching heat.iskorea.org subpage)
   =================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1.5px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-soft);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.manual-sec {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 14px;
}

.manual-sec:last-child {
  border-bottom: none;
}

/* ===================================================
   SAFETY GUIDELINES CARD
   =================================================== */
.safety-guidelines-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.safety-rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background-color: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: 9px;
  transition: all 0.2s ease;
}

.safety-rule-item:hover {
  border-color: #2563eb;
  transform: translateY(-1px);
}

.safety-rule-item .rule-icon {
  font-size: 18px;
  line-height: 1.2;
  flex-shrink: 0;
  margin-top: 1px;
}

.safety-rule-item .rule-content strong {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.safety-rule-item .rule-content p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

html.dark .safety-rule-item {
  background-color: #1e293b;
  border-color: #334155;
}

html.dark .safety-rule-item .rule-content strong {
  color: #f1f5f9;
}

/* Safety Guidelines Lock Overlay for Free Plan */
#safetyGuidelinesCard {
  position: relative;
  overflow: hidden;
}

#safetyGuidelinesCard.is-locked .safety-guidelines-grid {
  filter: blur(4.5px);
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
}

.safety-lock-overlay {
  display: none;
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  z-index: 10;
  border-radius: 0 0 12px 12px;
}

#safetyGuidelinesCard.is-locked .safety-lock-overlay {
  display: flex;
}

html.dark .safety-lock-overlay {
  background: rgba(30, 41, 59, 0.90);
}

.btn-unlock-pro-inline {
  padding: 9px 20px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff7f00, #ea580c);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-unlock-pro-inline:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.45);
}

/* ===================================================
   PLAN SETUP INPUT TABLE MODAL
   =================================================== */
.plan-setup-table-wrap {
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--bg-card);
}

.plan-setup-table {
  width: 100%;
  border-collapse: collapse;
}

.plan-setup-table th, .plan-setup-table td {
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  font-size: 13px;
  vertical-align: middle;
}

.plan-setup-table th {
  background-color: var(--bg-soft);
  color: var(--text-dark);
  font-weight: 800;
  width: 22%;
  white-space: nowrap;
}

.plan-setup-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--border-light);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-dark);
  background-color: var(--bg-card);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.plan-setup-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.plan-gen-btn {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.plan-gen-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

html.dark .plan-setup-table-wrap {
  border-color: var(--border-light);
  background: #1e293b;
}

html.dark .plan-setup-table th {
  background-color: #0f172a;
  color: #f1f5f9;
}

html.dark .plan-setup-input {
  background-color: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

.manual-sec-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--brand-orange);
  margin-bottom: 6px;
}

.manual-sec-title.warning {
  color: #ef4444;
}

.manual-sec-body {
  font-size: 13px;
  color: var(--text-primary);
  white-space: pre-line;
  line-height: 1.6;
}

.manual-sec-body.warning {
  color: #ef4444;
  font-weight: 700;
}

/* FOOTER */
.app-footer {
  text-align: center;
  padding: 30px 20px 50px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  margin-top: 20px;
}

/* ===================================================
   RESPONSIVE OPTIMIZATIONS (Mobile & Tablet)
   =================================================== */
@media (max-width: 768px) {
  .main-container {
    padding: 12px 10px;
    gap: 14px;
  }

  .header-inner {
    padding: 8px 10px;
  }

  .brand-wrap {
    gap: 8px;
    min-width: 0;
    flex-shrink: 1;
  }

  .brand-text {
    min-width: 0;
  }

  .app-logo-box {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .brand-text .title-full {
    display: none !important;
  }

  .brand-text .title-short {
    display: inline !important;
  }

  .brand-text h1 {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }

  .header-actions {
    gap: 4px;
    flex-shrink: 0;
  }

  .hdr-btn-ver,
  .version-badge {
    height: 30px;
    min-width: 28px;
    padding: 0 5px;
    font-size: 9.5px;
    font-weight: 700;
    border-radius: 7px;
  }

  .hdr-btn-pro,
  .pro-badge-compact {
    width: 30px;
    height: 30px;
    font-size: 10px;
    border-radius: 7px;
    padding: 0;
  }

  .hdr-btn-net,
  .net-badge-compact {
    display: none !important;
  }

  .hdr-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    padding: 0;
  }

  .hdr-btn svg {
    width: 17px;
    height: 17px;
  }

  .lang-btn {
    height: 30px;
    padding: 0 4px;
    border-radius: 7px;
    gap: 2px;
  }

  .flag-icon-circle {
    width: 18px;
    height: 18px;
  }

  .outline-card {
    padding: 14px 12px;
    border-radius: 12px;
  }

  .card-header-row {
    margin-bottom: 12px;
  }

  .card-title {
    font-size: 14.5px;
  }

  /* Mobile Material Selection: 2x2 Grid for compact, balanced view */
  .material-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .material-card {
    padding: 9px 10px;
    border-radius: 10px;
  }

  .mat-name {
    font-size: 13px;
  }

  .mat-density {
    font-size: 11.5px;
    margin-top: 1px;
  }

  .mat-std {
    font-size: 9.5px;
    margin-top: 1px;
  }

  .mat-dot {
    width: 8px;
    height: 8px;
  }

  .shape-dropdown-select {
    height: 42px;
    font-size: 14px;
    padding: 0 38px 0 14px;
  }

  .shape-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .shape-btn {
    height: 40px;
    font-size: 12.5px;
  }

  /* Dimension inputs */
  .dim-fields-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .full-col {
    grid-column: span 1;
  }

  .diagram-box {
    min-height: 165px;
    padding: 14px 16px;
    border-radius: 10px;
  }

  .shape-svg {
    max-width: 215px;
    max-height: 135px;
    overflow: visible;
  }

  .stepper-box {
    padding: 6px 10px;
  }

  .stepper-info input {
    font-size: 15px;
  }

  .unit-input {
    height: 40px;
    font-size: 14px;
    padding: 0 30px 0 10px;
  }

  .unit-tag {
    right: 10px;
    font-size: 11px;
  }

  /* Result Banners */
  .results-stack {
    gap: 8px;
  }

  .res-banner {
    padding: 12px 14px;
  }

  .res-label {
    font-size: 11px;
  }

  .res-val {
    font-size: 22px;
  }

  /* Lifting angles */
  .angle-toggle-group {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .angle-btn {
    height: 36px;
    font-size: 12px;
  }

  .gear-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .gear-card {
    padding: 10px 12px;
    gap: 6px;
  }

  .gear-val {
    font-size: 14.5px;
  }

  .crane-toggle-group {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .crane-btn {
    height: 38px;
    font-size: 12.5px;
  }

  .crane-result-box {
    padding: 10px 14px;
  }

  .safety-guidelines-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Records Table on mobile */
  .records-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .rec-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    width: 100%;
  }

  .rec-btn {
    height: 34px;
    padding: 0 4px;
    font-size: 11px;
    justify-content: center;
  }

  .records-table th, .records-table td {
    padding: 8px 10px;
    font-size: 11.5px;
  }

  /* Modal responsiveness */
  .modal-overlay {
    padding: 10px;
  }

  .modal-card {
    max-height: 92vh;
    border-radius: 14px;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-title {
    font-size: 15px;
  }

  .modal-body {
    padding: 14px 16px;
    gap: 14px;
  }

  .plan-setup-table, .plan-setup-table tbody, .plan-setup-table tr, .plan-setup-table th, .plan-setup-table td {
    display: block;
    width: 100% !important;
  }
  .plan-setup-table th {
    border-bottom: none;
    padding: 6px 10px 2px;
    font-size: 11.5px;
  }
  .plan-setup-table td {
    border-top: none;
    padding: 2px 10px 8px;
  }

  .app-footer {
    padding: 20px 10px 40px;
    font-size: 11px;
  }
}

/* Extra small devices (Galaxy Fold folded, iPhone SE) */
@media (max-width: 380px) {
  .header-inner {
    padding: 8px 6px;
    gap: 4px;
  }

  .brand-text h1 {
    font-size: 12px;
    max-width: 125px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hdr-btn-ver,
  .version-badge {
    height: 28px;
    min-width: 25px;
    padding: 0 4px;
    font-size: 8.5px;
    border-radius: 6px;
  }

  .app-logo-box {
    width: 28px;
    height: 28px;
  }

  .shape-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .angle-toggle-group {
    grid-template-columns: repeat(2, 1fr);
  }

  .res-val {
    font-size: 19px;
  }
}
