:root {
  --bg: #f6f7f2;
  --paper: #ffffff;
  --ink: #26342a;
  --muted: #6d7765;
  --line: #e5e8df;
  --green: #315b3e;
  --forest: #263c2d;
  --forest-deep: #1b2d21;
  --lime: #d8f778;
  --gold: #a88a3b;
  --radius: 24px;
}

html {
  font-family: Pretendard, 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

.tabular-nums,
.num-tabular {
  font-variant-numeric: tabular-nums;
}

.wrap,
.bu-wrap {
  width: min(1184px, calc(100% - 80px));
  margin-inline: auto;
  min-width: 0;
}

/* Original BUSTUDY top banner & 8-step font-size control (preserved from live /gold-price) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 78px;
  background: rgba(246, 247, 242, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.8px;
  white-space: nowrap;
  text-decoration: none;
}

.calculator-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.small-text-settings {
  position: relative;
  display: inline-block;
}

.text-size-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line, #dfe4d7);
  border-radius: 10px;
  background: #ffffff;
  color: #1f2922;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.text-size-trigger:hover {
  background: #f3f5ef;
}

.text-size-symbol {
  font-weight: 800;
  letter-spacing: -0.03em;
}

.text-size-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 200;
  width: 250px;
  background: #ffffff;
  border: 1px solid #dfe4d7;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  color: #1f2922;
}

.text-size-panel[hidden] {
  display: none !important;
}

.text-size-help {
  margin: 0 0 4px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  color: #263a2d;
}

.text-size-help-sub {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: #66756a;
}

.text-size-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.text-size-btn {
  padding: 7px 8px;
  border: 1px solid #d5dcd0;
  border-radius: 8px;
  background: #f8f9f5;
  color: #1f2922;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.text-size-btn:hover {
  background: #ebeee6;
}

.text-size-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #eef1ea;
  font-size: 12px;
}

.text-size-reset {
  border: none;
  background: none;
  color: #2e6f40;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
}

.text-size-reset:hover {
  text-decoration: underline;
}

.text-size-status {
  font-weight: 700;
  color: #4a584e;
}

.text-size-btn:disabled,
.text-size-reset:disabled {
  opacity: 0.45;
  cursor: default;
}

.site-header .all-calculators {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.site-header .all-calculators:hover {
  background: #eef3e3;
  border-color: #b6c8a7;
}

/* Dashboard cards & interactive controls */
.bu-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(32, 46, 36, 0.045);
}

.signal-card {
  background: linear-gradient(155deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  box-shadow: 0 18px 40px rgba(27, 45, 33, 0.18);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.signal-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #edf5ea;
  white-space: nowrap;
  flex-shrink: 0;
}

.signal-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  border-radius: 14px;
  background: var(--lime);
  color: #1b2d21;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease;
  text-decoration: none;
}

.signal-cta:hover {
  transform: translateY(-1px);
  filter: brightness(0.97);
}

.pill-active {
  background: var(--forest) !important;
  color: #ffffff !important;
  border-color: var(--forest) !important;
}

.bu-badge,
button {
  white-space: nowrap;
}

.bu-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #d7ddd0;
  background: #ffffff;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bu-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(49, 91, 62, 0.12);
}

details.bu-fold > summary {
  list-style: none;
  cursor: pointer;
}

details.bu-fold > summary::-webkit-details-marker {
  display: none;
}

details.bu-fold[open] .fold-plus {
  transform: rotate(45deg);
}

.toast-pop {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Collapsible table horizontal scroll hint (used by live quote gold-bar calculator) */
.tw {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tw.more::after {
  content: '밀어서 보기 →';
  position: sticky;
  right: 0;
  float: right;
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  background: rgba(246, 247, 242, 0.92);
  padding: 2px 6px;
  border-radius: 6px;
}

@media (max-width: 1100px) {
  .wrap,
  .bu-wrap {
    width: calc(100% - 48px);
  }
}

@media (max-width: 700px) {
  .wrap,
  .bu-wrap {
    width: calc(100% - 32px);
  }

  .site-header {
    height: 62px;
  }

  .header-inner {
    gap: 8px;
  }

  .site-header .all-calculators {
    padding: 7px 9px;
    font-size: 10px;
    min-height: 32px;
  }

  .text-size-trigger {
    padding: 6px 9px;
    font-size: 12px;
    min-height: 32px;
  }

  .signal-cta {
    font-size: 13.5px;
    padding: 12px 14px;
  }
}

@media (max-width: 460px) {
  .text-size-trigger-label {
    display: none;
  }

  .text-size-panel {
    width: 250px;
    max-width: calc(100vw - 32px);
  }
}
