:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66737d;
  --line: #dce3e8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --chip: #e9f5f3;
  --shadow: 0 18px 50px rgba(20, 35, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
}

button,
textarea,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 20px;
  min-height: 100vh;
  padding: 24px;
}

.editor-panel,
.result-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.editor-panel {
  padding: 24px;
}

.result-panel {
  overflow: hidden;
}

.title-row,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-header {
  flex: 0 0 auto;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 22px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--ink);
  border-color: #b9c7cf;
}

.icon-button span {
  font-size: 26px;
  line-height: 1;
}

.input-label {
  display: block;
  margin: 28px 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 420px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
  background: #fbfcfd;
  font-size: 17px;
  line-height: 1.7;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.stats strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.stats span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  min-width: 112px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.table-wrap {
  overflow: auto;
  height: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.token-cell {
  font-weight: 800;
  word-break: break-word;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.count-col {
  width: 82px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.empty-row td {
  height: 180px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 14px;
  }

  textarea {
    min-height: 300px;
  }

  .result-panel {
    min-height: 420px;
  }
}

@media (max-width: 520px) {
  .editor-panel {
    padding: 18px;
  }

  h1 {
    font-size: 28px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 12px;
  }
}
