:root {
  --bg: #e8e9eb;
  --panel: #ffffff;
  --sidebar: #ededed;
  --line: #d3d3d3;
  --line-dark: #bdbdbd;
  --text: #4f4f4f;
  --text-dark: #282828;
  --muted: #777;
  --accent: #b6402f;
  --accent-dark: #8f2d21;
  --accent-soft: #f6ece9;
  --key: #f7f7f7;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(#dfe5ed 0 18px, #ffffff 18px 36px, #e3e7ec 36px 54px, transparent 54px),
    var(--bg);
  font-family: Arial, "Noto Sans KR", "Malgun Gothic", sans-serif;
  line-height: 1.65;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page-shell {
  width: min(1020px, calc(100% - 32px));
  margin: 90px auto 36px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  background: var(--panel);
  border: 1px solid #d7d7d7;
  box-shadow: 0 3px 13px rgba(0,0,0,.12);
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid #d1d1d1;
  min-width: 0;
}

.brand {
  display: block;
  padding: 24px 26px 22px;
  text-decoration: none;
  color: var(--text-dark);
  border-bottom: 1px solid #c9c9c9;
}

.brand-main {
  display: block;
  font-size: 30px;
  letter-spacing: -1.7px;
  font-weight: 700;
  line-height: 1;
}
.brand-dot { color: #e11818; font-size: .72em; vertical-align: 2px; margin: 0 1px; }
.brand-sub { display: block; margin-top: 8px; font-size: 11px; letter-spacing: 5px; color: #9b9b9b; }

.side-box {
  margin: 0;
  padding: 18px 22px;
  border-top: 1px solid #fff;
  border-bottom: 1px solid #ccc;
  background: linear-gradient(#e1e1e1, #d8d8d8);
}
.side-box strong { color: #666; font-size: 14px; }
.side-box p { margin: 7px 0 0; font-size: 12px; color: #858585; line-height: 1.55; }

.side-nav { padding: 17px 0 10px; }
.side-nav a {
  display: block;
  padding: 7px 24px 7px 50px;
  color: #666;
  text-decoration: none;
  border-bottom: 1px solid #d7d7d7;
  position: relative;
  font-weight: 700;
  font-size: 14px;
}
.side-nav a::before {
  content: "▪";
  color: var(--accent);
  position: absolute;
  left: 35px;
}
.side-nav a:hover { color: var(--accent-dark); background: #f2f2f2; }

.side-meta {
  margin: 18px 20px;
  padding: 14px 13px;
  border: 1px solid #cfcfcf;
  background: #f7f7f7;
  font-size: 12px;
}
.side-meta span, .side-meta strong { display: block; }
.side-meta span { color: #888; }
.side-meta strong { margin-top: 3px; color: #5b5b5b; }

.content { padding: 25px 27px 32px; min-width: 0; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 2px solid #d5d5d5;
  padding-bottom: 8px;
}
.eyebrow { margin: 0 0 2px; font-size: 10px; letter-spacing: 2.3px; color: #aaa; }
.topbar h1 { margin: 0; color: #666; font-size: 24px; line-height: 1.2; letter-spacing: -1px; }
.topnav { display: flex; gap: 24px; font-size: 13px; white-space: nowrap; }
.topnav a { color: #666; text-decoration: none; }
.topnav a.active, .topnav a:hover { color: var(--accent); }

.section { padding: 24px 0 12px; }
.section + .section { border-top: 1px solid #ddd; }
.section h2 { margin: 0 0 12px; color: #4e4e4e; font-size: 17px; }
.section.compact h2 { margin-bottom: 7px; }
.intro { margin: 0 0 17px; font-size: 14px; }

.info-table { border-top: 1px solid #bbb; border-bottom: 1px solid #c8c8c8; margin-bottom: 21px; font-size: 13px; }
.info-row { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; background: #ededed; }
.info-row span, .info-row strong { padding: 6px 8px; min-width: 0; }
.info-head { background: #fff; color: #666; border-bottom: 1px solid #c9c9c9; }
.info-row strong { color: #666; }
.info-row strong:first-child { color: var(--accent); }

.search-panel {
  border: 1px solid #cfcfcf;
  background: #f7f7f7;
  padding: 18px;
}
.search-panel label { display: block; color: #555; font-size: 14px; font-weight: 700; margin-bottom: 7px; }
.position-wrap { display: flex; align-items: stretch; max-width: 520px; }
.position-input {
  min-width: 0;
  flex: 1;
  height: 51px;
  padding: 7px 14px;
  border: 1px solid #aaa;
  border-right: 0;
  border-radius: 2px 0 0 2px;
  color: #333;
  background: #fff;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  outline: none;
}
.position-input:focus { box-shadow: inset 0 0 0 1px var(--accent); }
.position-suffix {
  width: 58px;
  display: grid;
  place-items: center;
  border: 1px solid #aaa;
  background: #e8e8e8;
  color: #666;
  font-size: 13px;
}
.help-text { margin: 7px 0 14px; font-size: 12px; color: #858585; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  max-width: 520px;
}
.keypad button {
  min-height: 48px;
  border: 1px solid #bbb;
  border-radius: 2px;
  background: linear-gradient(#fff, #ececec);
  color: #444;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.keypad button:active { background: #e1e1e1; transform: translateY(1px); }
.keypad button:focus-visible { outline: 2px solid #777; outline-offset: 2px; }
.keypad .key-muted { color: #777; font-size: 13px; }
.keypad .key-search {
  color: #fff;
  border-color: var(--accent-dark);
  background: linear-gradient(#bd4a39, #9f3427);
  font-size: 14px;
}
.keypad .key-search:active { background: var(--accent-dark); }
.keypad button:disabled { opacity: .6; cursor: wait; transform: none; }

.message { min-height: 21px; margin: 10px 0 0; font-size: 12px; color: var(--accent-dark); }

.result-panel {
  margin-top: 22px;
  border-top: 2px solid #777;
  border-bottom: 1px solid #ccc;
  padding: 16px 0 20px;
}
.result-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.result-kicker { margin: 0 0 2px; color: var(--accent); font-size: 12px; font-weight: 700; }
.result-title-row h3 { margin: 0; color: #444; font-size: 19px; }
.text-button {
  border: 0;
  background: none;
  color: var(--accent-dark);
  padding: 6px 0;
  text-decoration: underline;
  cursor: pointer;
  font-size: 12px;
}

.result-table { margin-top: 12px; border-top: 1px solid #bbb; border-bottom: 1px solid #bbb; }
.result-table > div { display: grid; grid-template-columns: 115px 1fr; align-items: center; min-height: 38px; border-bottom: 1px solid #ddd; }
.result-table > div:last-child { border-bottom: 0; }
.result-table span { padding: 8px 10px; background: #eee; color: #666; font-size: 12px; height: 100%; display: flex; align-items: center; }
.result-table strong { padding: 7px 12px; color: #444; font-size: 13px; }
.result-table .answer-digit { color: var(--accent); font-size: 22px; line-height: 1; }

.digits-block { margin-top: 18px; }
.digits-block > p:first-child { margin: 0 0 7px; font-size: 13px; font-weight: 700; color: #5b5b5b; }
.pi-prefix { display: inline-block; margin-right: 4px; font-family: "Courier New", monospace; color: #777; font-size: 17px; }
.digits-line {
  display: inline;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 18px;
  line-height: 1.9;
  letter-spacing: 1.5px;
  word-break: break-all;
  color: #505050;
}
.digit-target {
  display: inline-block;
  padding: 0 3px;
  margin: 0 1px;
  border: 1px solid #bf857b;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1.45;
}
.digits-note { margin: 8px 0 0; font-size: 11px; color: #8b8b8b; }

.plain-list { margin: 0; padding-left: 22px; font-size: 13px; }
.section.compact p { margin: 0; font-size: 13px; }

.footer {
  margin-top: 25px;
  padding-top: 14px;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
}

@media (max-width: 760px) {
  body { background: #eceff2; }
  .page-shell {
    width: 100%;
    margin: 0;
    display: block;
    border: 0;
    box-shadow: none;
  }
  .sidebar { border-right: 0; border-bottom: 1px solid #cfcfcf; }
  .brand { padding: 17px 18px 14px; background: #e7e7e7; }
  .brand-main { font-size: 25px; }
  .brand-sub { margin-top: 6px; }
  .side-box, .side-nav, .side-meta { display: none; }
  .content { padding: 16px 16px 28px; }
  .topbar { align-items: center; }
  .eyebrow { display: none; }
  .topbar h1 { font-size: 20px; }
  .topnav { gap: 15px; font-size: 12px; }
  .section { padding-top: 20px; }
  .intro { font-size: 13px; }
  .info-row { grid-template-columns: 1.25fr .9fr .9fr; font-size: 11px; }
  .search-panel { padding: 14px; }
  .position-input { height: 50px; font-size: 22px; }
  .keypad button { min-height: 53px; font-size: 18px; }
  .keypad .key-muted, .keypad .key-search { font-size: 14px; }
  .result-title-row { align-items: flex-start; }
  .result-title-row h3 { font-size: 17px; }
  .result-table > div { grid-template-columns: 92px 1fr; }
  .digits-line { font-size: 17px; letter-spacing: 1.2px; }
  .footer { padding-bottom: 6px; }
}

@media (max-width: 390px) {
  .content { padding-left: 13px; padding-right: 13px; }
  .topnav { gap: 10px; }
  .topnav a:nth-child(2) { display: none; }
  .info-row { font-size: 10px; }
  .search-panel { padding: 12px; }
  .position-input { font-size: 20px; padding-left: 10px; }
  .position-suffix { width: 51px; }
}

.site-subtitle {
  margin: 3px 0 0;
  color: #777;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
