/* tokens.css — '토큰의 비밀' 페이지 전용 스타일 */

/* ── ① 토크나이저 놀이터 ── */
.sim .tok-panel {
  max-width: 860px;
  margin: 36px auto 0;
  min-height: 0;
  gap: 16px;
}

.tok-input-row {
  display: flex;
  gap: 10px;
}

#tok-input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  box-shadow: var(--shadow);
}

#tok-input:focus {
  outline: 2px solid var(--accent-border);
  border-color: var(--accent);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-chip {
  background: var(--track);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  font-size: 0.82rem;
  padding: 5px 14px;
  cursor: pointer;
  color: var(--text-dim);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.preset-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-deep);
}

.tok-output {
  min-height: 96px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.tok-placeholder {
  margin: auto;
  color: var(--text-soft);
  font-size: 0.9rem;
}

/* 토큰 조각 칩: 글자 + 어휘표 번호 */
.tok-piece {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px 5px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--tok-color, var(--accent));
  background: color-mix(in srgb, var(--tok-color, var(--accent)) 8%, white);
  animation: pop-in 0.3s ease backwards;
}

.tok-text {
  font-size: 1.15rem;
  font-weight: 600;
}

.tok-id {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.tok-counter {
  text-align: center;
  font-weight: 700;
  color: var(--accent);
  min-height: 1.5em;
}

.model-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* ── ② strawberry 실험 ── */
.straw {
  margin-top: 88px;
}

.straw-stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
  max-width: 980px;
  margin: 28px auto 0;
}

.straw-panel {
  min-height: 0;
  gap: 14px;
  align-items: center;
  text-align: center;
}

.straw-letters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.letter {
  width: 34px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--panel-border);
  border-radius: 8px;
  font-size: 1.3rem;
  font-weight: 600;
  font-family: Consolas, "Courier New", monospace;
}

.letter-r {
  background: #fef2f2;            /* red-50 */
  border-color: #fca5a5;          /* red-300 */
  color: #dc2626;                 /* red-600 */
}

.r-mark {
  color: #dc2626;
  font-family: Consolas, "Courier New", monospace;
}

.straw-tokens {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.straw-caption {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.straw-ask-row {
  max-width: 720px;
  margin: 20px auto 0;
  text-align: center;
}

.straw-answer {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 24px;
  font-size: 0.95rem;
  color: var(--text-dim);
  animation: pop-in 0.35s ease;
}

.straw-answer .ai-say {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.ai-oops {
  font-size: 0.9rem;
  font-weight: 600;
  color: #dc2626;
}

/* ── ③ 한국어 vs 영어 비교 ── */
.compare {
  margin-top: 88px;
}

.compare-panel {
  max-width: 860px;
  margin: 28px auto 0;
  min-height: 0;
  gap: 18px;
}

.compare-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compare-row {
  display: grid;
  grid-template-columns: 220px 1fr 70px;
  gap: 12px;
  align-items: center;
}

.compare-text {
  font-size: 0.92rem;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-track {
  height: 20px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}

.compare-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.bar-ko { background: var(--accent); }
.bar-en { background: #10b981; }     /* emerald-500 */

.compare-count {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
}

.compare-gap {
  height: 8px;
}

.compare-note {
  font-size: 0.9rem;
  color: var(--text-dim);
  text-align: center;
}

/* ── 좁은 화면 ── */
@media (max-width: 1024px) {
  .straw-stage {
    grid-template-columns: 1fr;
  }

  .tok-input-row {
    flex-direction: column;
  }

  .compare-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .compare-text {
    text-align: left;
  }
}

/* ── 모바일 ── */
@media (max-width: 640px) {
  .straw,
  .compare {
    margin-top: 56px;
  }

  .letter {
    width: 30px;
    height: 38px;
    font-size: 1.15rem;
  }

  /* 한 칸 레이아웃에서는 말줄임 대신 줄바꿈이 낫다 */
  .compare-text {
    white-space: normal;
  }
}
