:root {
  font-family:
    Inter,
    "Noto Sans JP",
    "Noto Sans KR",
    system-ui,
    sans-serif;

  color: #18181b;
  background: #fafaf9;

  --accent: #2563eb;
  --ko: #0f766e;
}


* {
  box-sizing: border-box;
}


body {
  margin: 0;

  background:
    radial-gradient(
      circle at 15% 0%,
      #dbeafe 0,
      transparent 28rem
    ),
    radial-gradient(
      circle at 90% 10%,
      #dcfce7 0,
      transparent 24rem
    ),
    #fafaf9;

  color: #18181b;
}


/* =========================
   ヘッダー
========================= */

.topbar {
  height: 68px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  max-width: 920px;

  margin: auto;

  padding: 0 22px;
}


.brand {
  text-decoration: none;

  color: #111;

  font-weight: 900;
  font-size: 21px;

  letter-spacing: -.03em;
}


.brand span {
  margin-left: 5px;

  color: #0f766e;

  font-size: 11px;
  font-weight: 700;
}


/* =========================
   メイン
========================= */

main {
  max-width: 820px;

  margin: auto;

  padding: 38px 20px 80px;
}


/* =========================
   HERO
========================= */

.hero {
  text-align: center;

  padding: 35px 10px 34px;
}


.eyebrow {
  display: inline-block;

  padding: 7px 12px;

  border: 1px solid #e4e4e7;
  border-radius: 999px;

  background: #fff;

  font-size: 13px;
  font-weight: 800;
}


h1 {
  margin: 22px 0;

  font-size:
    clamp(
      40px,
      8vw,
      70px
    );

  line-height: .98;

  letter-spacing: -.06em;
}


h1 em {
  color: #0f766e;

  font-style: normal;
}


.lead {
  max-width: 650px;

  margin: auto;

  color: #52525b;

  font-size: 16px;

  line-height: 1.9;
}


/* =========================
   カード
========================= */

.card {
  padding: 24px;

  border:
    1px solid #e4e4e7;

  border-radius: 24px;

  background:
    rgba(
      255,
      255,
      255,
      .9
    );

  box-shadow:
    0 20px 60px
    rgba(
      24,
      24,
      27,
      .07
    );
}


/* =========================
   入力
========================= */

.label-row {
  display: flex;

  align-items: center;
  justify-content: space-between;

  margin-bottom: 10px;

  color: #71717a;

  font-size: 13px;
}


label,
.section-title {
  color: #27272a;

  font-weight: 800;
}


textarea {
  width: 100%;

  min-height: 240px;

  padding: 18px;

  resize: vertical;

  border: 1px solid #e4e4e7;
  border-radius: 16px;

  outline: 0;

  background: #fafafa;

  font: inherit;

  line-height: 1.8;
}


.actions {
  display: flex;

  justify-content: space-between;

  gap: 10px;

  margin-top: 14px;
}


/* =========================
   ボタン共通
========================= */

button {
  border: 0;

  font: inherit;

  cursor: pointer;
}


.primary {
  min-width: 160px;

  padding: 13px 24px;

  border-radius: 13px;

  background: #18181b;

  color: #fff;

  font-weight: 800;
}


.primary:disabled {
  opacity: .55;

  cursor: wait;
}


.ghost {
  padding: 10px 14px;

  border:
    1px solid #e4e4e7;

  border-radius: 12px;

  background: #fff;

  font-weight: 700;
}


.small {
  padding: 7px 10px;

  font-size: 12px;
}


/* =========================
   エラー
========================= */

.error {
  padding: 10px 12px;

  border-radius: 10px;

  background: #fef2f2;

  color: #b91c1c;

  font-size: 13px;
}


/* =========================
   結果
========================= */

.result-card {
  margin-top: 22px;
}


.result-head {
  display: flex;

  align-items: flex-start;
  justify-content: space-between;
}


.ratio-readout {
  margin-top: 5px;

  font-size: 18px;
}


.ratio-readout span {
  margin: 0 5px;

  color: #a1a1aa;
}


#ratio {
  width: 100%;

  margin:
    24px 0 6px;

  accent-color: #0f766e;
}


.ticks {
  display: flex;

  justify-content: space-between;

  color: #71717a;

  font-size: 11px;
}


.hint {
  margin:
    24px 0 10px;

  padding: 10px 12px;

  border-radius: 12px;

  background: #f0fdfa;

  color: #115e59;

  font-size: 12px;
}


/* =========================
   ミックス文章
========================= */

.mixed-text {
  padding: 12px 4px;

  white-space: pre-wrap;

  font-size: 18px;

  line-height: 2.15;
}


.sentence {
  padding: 2px 3px;

  border-radius: 8px;

  transition: .15s;
}


.sentence.ko {
  background: #f0fdfa;

  color: #0f766e;

  cursor: pointer;

  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}


.sentence.manual-ja {
  background: #f4f4f5;

  cursor: pointer;
}


/* =========================
   使い方
========================= */

.how {
  padding:
    60px 0 10px;
}


.how h2 {
  text-align: center;

  font-size: 30px;

  letter-spacing: -.04em;
}


.steps {
  display: grid;

  grid-template-columns:
    repeat(
      3,
      1fr
    );

  gap: 14px;

  margin-top: 25px;
}


.steps > div {
  padding: 18px;

  border:
    1px solid #e4e4e7;

  border-radius: 18px;

  background: #fff;
}


.steps b {
  width: 30px;
  height: 30px;

  display: inline-grid;
  place-items: center;

  border-radius: 50%;

  background: #18181b;

  color: white;
}


.steps h3 {
  margin:
    14px 0 6px;

  font-size: 16px;
}


.steps p {
  margin: 0;

  color: #71717a;

  font-size: 13px;

  line-height: 1.7;
}


/* =========================
   フッター
========================= */

footer {
  padding:
    30px 20px 50px;

  text-align: center;

  color: #a1a1aa;

  font-size: 11px;
}


/* =========================
   履歴ダイアログ
========================= */

dialog {
  width:
    min(
      620px,
      calc(
        100% - 28px
      )
    );

  padding: 22px;

  border: 0;

  border-radius: 20px;

  box-shadow:
    0 30px 90px
    #0003;
}


dialog::backdrop {
  background: #0006;

  backdrop-filter:
    blur(3px);
}


.dialog-head {
  display: flex;

  align-items: center;
  justify-content: space-between;
}


.dialog-head h2 {
  margin: 0;
}


.privacy {
  color: #71717a;

  font-size: 12px;
}


.history-item {
  padding: 14px 2px;

  border-top:
    1px solid #e4e4e7;

  cursor: pointer;
}


.history-item b {
  display: block;

  font-size: 13px;
}


.history-item p {
  overflow: hidden;

  margin:
    5px 0 0;

  color: #71717a;

  font-size: 12px;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.danger-link {
  margin-top: 12px;

  padding: 8px 0;

  background: none;

  color: #b91c1c;
}


/* ========================================
   韓国語 学習・解説カード
======================================== */

.explanation-overlay {
  position: fixed;

  inset: 0;

  z-index: 9999;

  display: flex;

  justify-content: center;
  align-items: flex-end;

  padding: 18px;

  background:
    rgba(
      15,
      23,
      42,
      .55
    );

  backdrop-filter:
    blur(5px);
}


.explanation-card {
  width:
    min(
      680px,
      100%
    );

  max-height: 90vh;

  overflow-y: auto;

  padding: 26px;

  border-radius: 26px;

  background: white;

  box-shadow:
    0 -15px 70px
    rgba(
      0,
      0,
      0,
      .25
    );

  animation:
    explanation-in
    .22s ease-out;
}


@keyframes explanation-in {

  from {
    opacity: 0;

    transform:
      translateY(35px);
  }

  to {
    opacity: 1;

    transform:
      translateY(0);
  }
}


/* =========================
   解説上部
========================= */

.exp-top {
  display: flex;

  align-items: flex-start;

  gap: 14px;
}


.exp-korean-area {
  flex: 1;
}


.exp-ko {
  color: #0f766e;

  font-size: 25px;

  font-weight: 900;

  line-height: 1.55;

  word-break: keep-all;
}


.exp-romaji {
  margin-top: 5px;

  color: #71717a;

  font-size: 14px;

  line-height: 1.5;

  letter-spacing: .02em;
}


.exp-speak {
  width: 48px;
  height: 48px;

  flex-shrink: 0;

  border:
    1px solid #d4d4d8;

  border-radius: 15px;

  background: white;

  font-size: 20px;

  cursor: pointer;
}


.exp-speak:active {
  transform: scale(.92);
}


/* =========================
   再生速度
========================= */

.speed-box {
  display: grid;

  grid-template-columns:
    repeat(
      3,
      1fr
    );

  gap: 6px;

  margin-top: 20px;

  padding: 6px;

  border:
    1px solid #e4e4e7;

  border-radius: 15px;

  background: #fafafa;
}


.speed-button {
  padding: 10px 6px;

  border:
    1px solid transparent;

  border-radius: 11px;

  background: transparent;

  color: #52525b;

  font-weight: 800;

  cursor: pointer;

  transition: .15s;
}


.speed-button.active {
  border-color: #0d9488;

  background: #f0fdfa;

  color: #0f766e;
}


.speed-button:active {
  transform: scale(.96);
}


/* =========================
   解説セクション
========================= */

.explanation-card h3 {
  margin:
    24px 0 10px;

  color: #27272a;

  font-size: 16px;
}


.meaning {
  margin: 0;

  color: #27272a;

  font-size: 16px;

  line-height: 1.8;
}


/* =========================
   単語
========================= */

.word-list {
  overflow: hidden;

  border:
    1px solid #e4e4e7;

  border-radius: 16px;
}


.word-row {
  display: grid;

  grid-template-columns:
    minmax(
      80px,
      1fr
    )
    minmax(
      90px,
      1fr
    )
    minmax(
      90px,
      1.3fr
    )
    40px;

  align-items: center;

  gap: 10px;

  padding: 12px 14px;

  border-bottom:
    1px solid #f1f1f1;
}


.word-row:last-child {
  border-bottom: 0;
}


.word-ko {
  color: #0f766e;

  font-size: 17px;

  font-weight: 900;
}


.word-romaji {
  color: #71717a;

  font-size: 13px;

  line-height: 1.4;
}


.word-ja {
  color: #27272a;

  font-size: 14px;

  line-height: 1.5;
}


.word-speak {
  width: 36px;
  height: 36px;

  padding: 0;

  border:
    1px solid #d4d4d8;

  border-radius: 11px;

  background: white;

  cursor: pointer;
}


.word-speak:active {
  transform: scale(.92);
}


/* =========================
   文法
========================= */

.grammar-list {
  overflow: hidden;

  border:
    1px solid #e4e4e7;

  border-radius: 16px;
}


.grammar-box {
  margin: 0;

  padding: 14px 16px;

  border-bottom:
    1px solid #e4e4e7;

  border-radius: 0;

  background: white;
}


.grammar-box:last-child {
  border-bottom: 0;
}


.grammar-box b {
  color: #0f766e;

  font-size: 16px;
}


.grammar-box p {
  margin:
    6px 0 0;

  color: #52525b;

  font-size: 14px;

  line-height: 1.7;
}


/* =========================
   解説下部ボタン
========================= */

.explanation-buttons {
  display: grid;

  grid-template-columns:
    1fr 1fr;

  gap: 10px;

  margin-top: 26px;
}


.explanation-buttons button {
  width: 100%;

  min-height: 48px;
}


/* =========================
   スマホ
========================= */

@media (
  max-width: 640px
) {

  main {
    padding-top: 10px;
  }


  .hero {
    padding-top: 20px;
  }


  .card {
    padding: 17px;

    border-radius: 18px;
  }


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


  .mixed-text {
    font-size: 17px;
  }


  .actions {
    flex-direction: column;
  }


  .primary {
    width: 100%;
  }


  /* 解説カード */

  .explanation-overlay {
    padding: 0;

    align-items: flex-end;
  }


  .explanation-card {
    width: 100%;

    max-height: 91vh;

    padding:
      22px 17px 28px;

    border-radius:
      25px 25px 0 0;
  }


  .exp-ko {
    font-size: 22px;
  }


  .exp-romaji {
    font-size: 13px;
  }


  .exp-speak {
    width: 44px;
    height: 44px;
  }


  .word-row {
    grid-template-columns:
      minmax(
        65px,
        .9fr
      )
      minmax(
        75px,
        1fr
      )
      minmax(
        65px,
        1fr
      )
      36px;

    gap: 7px;

    padding: 11px 10px;
  }


  .word-ko {
    font-size: 15px;
  }


  .word-romaji {
    font-size: 11px;
  }


  .word-ja {
    font-size: 13px;
  }
}
