/* ROBERIN energy-converter (에너지 단위 변환기) - The New workspace v3 (20260716b)
 * Scope: .tn-enc-* only. Full-width composition: 좁은 좌우 split + 세로로 긴 16단위 표를 폐기하고
 * 전체 폭을 채우는 상하 밴드로 재구성 — 입력 밴드(전체 폭) / 결과(J 히어로 | 에너지 스펙트럼 좌우) /
 * 16단위 4열 그리드(가로로 펼쳐 짧게) / 실생활 비교 3열.
 * Gates: realtime (#17), fills usable width no idle pane (#15/#28), container gap (#22/#37),
 * no decorative rail (#30), custom select chevron (#33), flipped dark + text-fill (#8/#14),
 * quiet flat wash (#27), element reset li/ul/ol/dd only (#37). */

.tn-enc-page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  color: #1a1208;
  -webkit-text-fill-color: currentColor;
}
.tn-enc-page,
.tn-enc-page * { box-sizing: border-box; }

.tn-enc-tool {
  --enc-ink: #1a1208;
  --enc-muted: #5a4a30;
  --enc-line: #b8a888;
  --enc-soft: #cbb692;
  --enc-paper: #fffdf8;
  --enc-wash: #f6eddc;
  --enc-panel: #fbf6ec;
  --enc-surface: #fffdf8;
  --enc-card: #fbf4e6;
  --enc-band-bg: #f4ecda;
  --enc-track: #e7dcc4;
  --enc-accent: #b4600f;
  --enc-accent-soft: #f0e0c8;
  --enc-btn-sec-bg: #f2e7d3;
  --enc-btn-sec-hover: #e7d8bd;
  --enc-btn-sec-text: #3a2c18;
  color: var(--enc-ink);
  -webkit-text-fill-color: var(--enc-ink);
  font-family: inherit;
  display: grid;
  gap: 16px;
}

.tn-enc-tool ul,
.tn-enc-tool ol,
.tn-enc-tool li,
.tn-enc-tool dd { margin: 0; padding: 0; list-style: none; }

/* ---- full-width bands ---- */
.tn-enc-input,
.tn-enc-result {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--enc-soft);
  border-radius: 5px;
}
.tn-enc-input { background: var(--enc-wash); }
.tn-enc-result { background: var(--enc-panel); }
.tn-enc-pane-label {
  margin: 0;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--enc-muted);
  -webkit-text-fill-color: var(--enc-muted);
}
.tn-enc-band-label {
  margin: 0;
  font: 700 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--enc-muted);
  -webkit-text-fill-color: var(--enc-muted);
}

/* ---- input band ---- */
.tn-enc-presets { display: grid; gap: 8px; }
.tn-enc-preset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tn-enc-preset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--enc-soft);
  border-radius: 5px;
  background: var(--enc-card);
  font: 600 12px/1.1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--enc-ink);
  -webkit-text-fill-color: var(--enc-ink);
  cursor: pointer;
}
.tn-enc-preset:hover { border-color: var(--enc-accent); background: var(--enc-accent-soft); }
.tn-enc-preset:focus-visible { outline: 2px solid var(--enc-accent); outline-offset: 2px; }

.tn-enc-inputrow {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}
.tn-enc-field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.tn-enc-label { font-size: 12px; font-weight: 600; color: var(--enc-muted); -webkit-text-fill-color: var(--enc-muted); }
.tn-enc-hint {
  font-size: 11px;
  line-height: 1.4;
  min-height: 15.4px;
  color: var(--enc-muted);
  -webkit-text-fill-color: var(--enc-muted);
}
.tn-enc-hint b { font-weight: 700; font-style: normal; color: var(--enc-accent); -webkit-text-fill-color: var(--enc-accent); }
.tn-enc-control {
  display: flex;
  align-items: stretch;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--enc-line);
  border-radius: 5px;
  background: var(--enc-paper);
  overflow: hidden;
}
.tn-enc-control input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: 0 13px;
  border: 0;
  background: transparent;
  color: var(--enc-ink);
  -webkit-text-fill-color: var(--enc-ink);
  font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.tn-enc-control input::placeholder { color: var(--enc-muted); -webkit-text-fill-color: var(--enc-muted); opacity: 0.55; }
.tn-enc-control input::-webkit-input-placeholder { color: var(--enc-muted); -webkit-text-fill-color: var(--enc-muted); opacity: 0.55; }
.tn-enc-control input:focus-visible { outline: 2px solid var(--enc-accent); outline-offset: -2px; }
.tn-enc-control--select select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 34px 0 13px;
  border: 0;
  background: transparent;
  color: var(--enc-ink);
  -webkit-text-fill-color: var(--enc-ink);
  font: 600 14px/1 inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%235a4a30' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.tn-enc-control--select select:focus-visible { outline: 2px solid var(--enc-accent); outline-offset: -2px; }
.tn-enc-reset {
  align-self: start;
  margin-top: 22px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--enc-line);
  border-radius: 5px;
  background: var(--enc-btn-sec-bg);
  color: var(--enc-btn-sec-text);
  -webkit-text-fill-color: var(--enc-btn-sec-text);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}
.tn-enc-reset:hover { background: var(--enc-btn-sec-hover); }
.tn-enc-reset:focus-visible { outline: 2px solid var(--enc-accent); outline-offset: 2px; }
.tn-enc-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--enc-soft);
  border-radius: 5px;
  background: var(--enc-band-bg);
  font-size: 12px;
  line-height: 1.5;
  color: var(--enc-muted);
  -webkit-text-fill-color: var(--enc-muted);
}

/* ---- result headline: J hero | spectrum (full width) ---- */
.tn-enc-headline {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 22px;
  align-items: center;
  padding: 4px 2px 14px;
  border-bottom: 1px solid var(--enc-track);
}
.tn-enc-hero { display: grid; gap: 4px; min-width: 0; }
.tn-enc-hero-label {
  font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--enc-muted);
  -webkit-text-fill-color: var(--enc-muted);
}
.tn-enc-hero strong {
  font: 800 clamp(30px, 4.4vw, 46px)/1.06 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--enc-ink);
  -webkit-text-fill-color: var(--enc-ink);
  letter-spacing: -0.01em;
  word-break: break-word;
}
.tn-enc-main-sub { font-size: 12px; font-style: normal; line-height: 1.45; color: var(--enc-muted); -webkit-text-fill-color: var(--enc-muted); }
.tn-enc-main-sub b { font-weight: 700; color: var(--enc-accent); -webkit-text-fill-color: var(--enc-accent); }

.tn-enc-spectrum { display: grid; gap: 6px; min-width: 0; }
.tn-enc-spec-track { height: 14px; border-radius: 5px; background: var(--enc-track); overflow: hidden; }
.tn-enc-spec-fill { height: 100%; width: 0; border-radius: 5px; background: var(--enc-accent); transition: width 0.28s ease; }
.tn-enc-spec-scale {
  display: flex;
  justify-content: space-between;
  font: 500 10px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--enc-muted);
  -webkit-text-fill-color: var(--enc-muted);
}
.tn-enc-spec-note { margin: 2px 0 0; font-size: 12px; line-height: 1.45; color: var(--enc-muted); -webkit-text-fill-color: var(--enc-muted); }
.tn-enc-spec-note b { font-weight: 700; color: var(--enc-accent); -webkit-text-fill-color: var(--enc-accent); }

/* ---- full 16-unit grid (wide, short) ---- */
.tn-enc-units { display: grid; gap: 10px; }
.tn-enc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tn-enc-ucell {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 10px 12px;
  border: 1px solid var(--enc-soft);
  border-radius: 5px;
  background: var(--enc-card);
  min-width: 0;
}
.tn-enc-ucell .tn-enc-uname {
  font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--enc-muted);
  -webkit-text-fill-color: var(--enc-muted);
}
.tn-enc-ucell .tn-enc-uval {
  font: 700 15px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--enc-ink);
  -webkit-text-fill-color: var(--enc-ink);
  word-break: break-word;
}
.tn-enc-ucell.is-source { border-color: var(--enc-accent); background: var(--enc-accent-soft); }

/* ---- real-life comparison ---- */
.tn-enc-compare { display: grid; gap: 10px; }
.tn-enc-compare-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tn-enc-ccard {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 13px 14px;
  border: 1px solid var(--enc-soft);
  border-radius: 5px;
  background: var(--enc-band-bg);
  min-width: 0;
}
.tn-enc-ccard .tn-enc-cico { font-size: 22px; line-height: 1; -webkit-text-fill-color: initial; }
.tn-enc-ccard .tn-enc-ctitle { font: 700 13px/1.2 inherit; color: var(--enc-ink); -webkit-text-fill-color: var(--enc-ink); }
.tn-enc-ccard .tn-enc-cdesc { font-size: 11px; line-height: 1.5; color: var(--enc-muted); -webkit-text-fill-color: var(--enc-muted); }
.tn-enc-ccard .tn-enc-cdesc b { font-weight: 700; color: var(--enc-accent); -webkit-text-fill-color: var(--enc-accent); }

/* ---- copy + disclaimer ---- */
.tn-enc-command { display: grid; }
.tn-enc-copy {
  height: 42px;
  border: 1px solid var(--enc-line);
  border-radius: 5px;
  background: var(--enc-btn-sec-bg);
  color: var(--enc-btn-sec-text);
  -webkit-text-fill-color: var(--enc-btn-sec-text);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tn-enc-copy:hover { background: var(--enc-btn-sec-hover); }
.tn-enc-copy:focus-visible { outline: 2px solid var(--enc-accent); outline-offset: 2px; }
.tn-enc-disclaimer {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--enc-track);
  font-size: 11px;
  line-height: 1.5;
  color: var(--enc-muted);
  -webkit-text-fill-color: var(--enc-muted);
}

/* ---- responsive ---- */
@media (max-width: 860px) {
  .tn-enc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tn-enc-headline { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .tn-enc-inputrow { grid-template-columns: minmax(0, 1fr); }
  .tn-enc-reset { margin-top: 0; width: 100%; }
  .tn-enc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tn-enc-compare-list { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Dark / inverse / auto-dark (#8/#14) ---- */
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-enc-tool,
html[data-scheme="dark"] body:not([data-scheme="light"]) .tn-enc-tool,
html[data-scheme="inverse"] body:not([data-scheme="light"]) .tn-enc-tool {
  --enc-ink: #efe6d2;
  --enc-muted: #c3b492;
  --enc-line: #6f6047;
  --enc-soft: #574a37;
  --enc-paper: #241d12;
  --enc-wash: #221b11;
  --enc-panel: #201a10;
  --enc-surface: #1f1810;
  --enc-card: rgba(58, 48, 32, 0.5);
  --enc-band-bg: rgba(58, 48, 32, 0.36);
  --enc-track: rgba(120, 104, 74, 0.32);
  --enc-accent: #e0a24d;
  --enc-accent-soft: rgba(224, 162, 77, 0.2);
  --enc-btn-sec-bg: #33291a;
  --enc-btn-sec-hover: #453720;
  --enc-btn-sec-text: #efe6d2;
  color: var(--enc-ink);
  -webkit-text-fill-color: var(--enc-ink);
}
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-enc-control--select select,
html[data-scheme="dark"] body:not([data-scheme="light"]) .tn-enc-control--select select,
html[data-scheme="inverse"] body:not([data-scheme="light"]) .tn-enc-control--select select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23c3b492' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-enc-tool {
    --enc-ink: #efe6d2;
    --enc-muted: #c3b492;
    --enc-line: #6f6047;
    --enc-soft: #574a37;
    --enc-paper: #241d12;
    --enc-wash: #221b11;
    --enc-panel: #201a10;
    --enc-surface: #1f1810;
    --enc-card: rgba(58, 48, 32, 0.5);
    --enc-band-bg: rgba(58, 48, 32, 0.36);
    --enc-track: rgba(120, 104, 74, 0.32);
    --enc-accent: #e0a24d;
    --enc-accent-soft: rgba(224, 162, 77, 0.2);
    --enc-btn-sec-bg: #33291a;
    --enc-btn-sec-hover: #453720;
    --enc-btn-sec-text: #efe6d2;
    color: var(--enc-ink);
    -webkit-text-fill-color: var(--enc-ink);
  }
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-enc-control--select select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23c3b492' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}
