:root {
  --navy: #062f52;
  --navy-deep: #03233d;
  --blue: #00bfff;
  --blue-soft: #dff7ff;
  --paper: #f5f8fa;
  --white: #ffffff;
  --ink: #10283b;
  --muted: #5b7080;
  --line: #d8e2e8;
  --warning: #fff4bf;
  --danger: #a82c2c;
  --shadow: 0 18px 55px rgba(0, 30, 54, 0.13);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; }
body.modal-open { overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }

.loading { min-height: 100dvh; background: var(--navy); }
.disclaimer-overlay { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; overflow-y: auto; padding: 24px; background: rgba(3, 35, 61, .84); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.disclaimer-overlay[hidden] { display: none; }
.disclaimer-card { width: min(100%, 440px); padding: 34px; border-radius: 24px; background: var(--white); text-align: center; box-shadow: var(--shadow); }
.warning-mark { display: grid; place-items: center; width: 70px; height: 70px; margin: 0 auto 22px; border: 4px solid var(--blue); border-radius: 50%; color: var(--navy); font-size: 42px; font-weight: 800; }
.disclaimer-card h1 { margin: 6px 0 12px; font-size: clamp(1.8rem, 8vw, 2.35rem); line-height: 1.05; }
.disclaimer-card > p:not(.eyebrow) { margin: 0 auto 26px; color: var(--muted); line-height: 1.65; }
.eyebrow { margin: 0 0 5px; color: #087cab; font-size: .74rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.primary-button { min-height: 52px; border: 0; border-radius: 13px; padding: 0 24px; background: var(--blue); color: #03263d; font-weight: 800; box-shadow: 0 8px 22px rgba(0, 191, 255, .22); }
.primary-button:hover { background: #29caff; }
.primary-button:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid rgba(0,191,255,.42); outline-offset: 3px; }

.app-shell { min-height: 100dvh; padding-bottom: 26px; background: linear-gradient(var(--navy) 0 260px, var(--paper) 260px); }
.branded-header { position: relative; background: linear-gradient(90deg, rgba(3,35,61,.97), rgba(3,35,61,.76)), url('images/railroadbackground.png') center 48% / cover no-repeat; border-bottom: 1px solid rgba(0,191,255,.4); }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; width: min(100% - 32px, 920px); margin: 0 auto; }
.brand { display: flex; align-items: center; color: #f2f0ed; text-decoration: none; font-size: 1.23rem; letter-spacing: -.04em; }
.brand img { width: 38px; height: 38px; margin-right: 11px; object-fit: contain; }
.brand strong { color: var(--blue); }
.product-name { margin-left: 12px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.32); color: #c8dbe8; font-size: .78rem; font-weight: 750; letter-spacing: .01em; }
.about-button { min-width: 52px; min-height: 42px; border: 1px solid rgba(255,255,255,.3); border-radius: 11px; background: rgba(255,255,255,.08); color: white; font-weight: 700; }
.content { width: min(100% - 24px, 720px); margin: 0 auto; }
.intro { padding: 24px 6px 21px; color: white; }
.intro .eyebrow { color: var(--blue); }
.intro h1 { margin: 5px 0 8px; font-size: clamp(1.85rem, 7vw, 2.65rem); letter-spacing: -.04em; line-height: 1.05; }
.intro > p:last-child { margin: 0; color: #c8dbe8; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 5px; border-radius: 16px; background: var(--white); box-shadow: var(--shadow); }
.tabs button { min-height: 58px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 1.05rem; font-weight: 800; }
.tabs button span { display: block; margin-bottom: 2px; font-size: .65rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.tabs button.active { background: var(--navy); color: white; box-shadow: 0 6px 18px rgba(6,47,82,.22); }
.tabs button.active span { color: var(--blue); }

.percent-form { display: grid; grid-template-columns: 1fr auto; gap: 9px 12px; margin: 15px 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 10px 34px rgba(0,30,54,.07); }
.percent-form label { grid-column: 1 / -1; color: var(--ink); font-size: .85rem; font-weight: 800; }
.input-wrap { position: relative; }
.input-wrap input { width: 100%; height: 54px; border: 2px solid #b7c9d4; border-radius: 12px; padding: 0 50px 0 15px; background: #fbfdfe; color: var(--ink); font-size: 1.25rem; font-weight: 800; }
.input-wrap input:focus { border-color: var(--blue); outline: none; }
.input-wrap span { position: absolute; top: 50%; right: 17px; transform: translateY(-50%); color: var(--muted); font-weight: 800; }
.error-message { margin: 0 0 15px; padding: 13px 15px; border-left: 4px solid var(--danger); border-radius: 9px; background: #fff0f0; color: var(--danger); font-weight: 700; }

.result-card, .about-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--white); box-shadow: var(--shadow); }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; background: linear-gradient(120deg, #fff, #eef9fd); }
.result-heading h2 { margin: 3px 0 0; font-size: 1.45rem; letter-spacing: -.03em; }
.percent-badge { display: flex; align-items: baseline; justify-content: center; min-width: 78px; padding: 10px 12px; border-radius: 14px; background: var(--navy); color: white; }
.percent-badge strong { font-size: 1.65rem; }
.percent-badge span { color: var(--blue); font-weight: 800; }
.rounded-note { margin: 0 16px 14px; padding: 11px 13px; border-radius: 10px; background: var(--blue-soft); color: #075b7d; font-size: .88rem; line-height: 1.45; }
.table-note { margin: 0; padding: 0 20px 17px; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.table-wrap { border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 20px; background: var(--navy); color: white; text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
th:last-child, td:last-child { text-align: right; }
td { padding: 13px 20px; border-bottom: 1px solid #e4ebef; font-size: 1rem; }
tbody tr:nth-child(even) { background: #f1f6f8; }
td strong { font-size: 1.13rem; }
td span { color: var(--muted); font-size: .86rem; }
tbody tr:last-child td { border-bottom: 0; }

.about-panel { margin-top: 24px; padding: 26px; }
.about-panel h1 { margin: 5px 0 20px; font-size: 2rem; }
.about-panel > p { color: var(--muted); line-height: 1.65; }
.about-panel a { color: #087cab; font-weight: 800; }
.notice { margin: 0 0 20px; padding: 16px; border-left: 5px solid #e2b400; border-radius: 10px; background: var(--warning); }
.notice p { margin: 7px 0 0; line-height: 1.55; }
footer { width: min(100% - 32px, 720px); margin: 22px auto 0; color: #687b88; text-align: center; font-size: .74rem; }

@media (max-width: 430px) {
  .content { width: min(100% - 16px, 720px); }
  .topbar { width: calc(100% - 24px); }
  .percent-form { padding: 14px; }
  .percent-form .primary-button { padding-inline: 15px; }
  td, th { padding-inline: 16px; }
  .product-name { display: block; margin: 1px 0 0; padding: 0; border: 0; font-size: .66rem; }
  .brand { display: grid; grid-template-columns: auto 1fr; }
  .brand img { grid-row: 1 / 3; }
}

@media (min-width: 780px) {
  .app-shell { background: linear-gradient(var(--navy) 0 280px, var(--paper) 280px); }
  .topbar { height: 86px; }
  .intro { padding-top: 31px; }
  .percent-form { padding: 22px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .app-shell { background: linear-gradient(var(--navy) 0 185px, var(--paper) 185px); }
  .topbar { height: 58px; }
  .intro { padding: 10px 6px 14px; }
  .intro h1 { font-size: 1.6rem; }
  .intro > p:last-child { display: none; }
  .tabs button { min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
