@import url("/shared/web-punctuation.css?v=91fae76945a7");
@import url("/shared/web-hangul-font.css?v=6e95ca0b9ba8");
:root {
  --bg: #f5f8f7;
  --panel: #ffffff;
  --text: #19272a;
  --muted: #5d6c70;
  --line: #ccdae0;
  --accent: #0a7180;
  --accent-strong: #085764;
  --accent-soft: #e7f4f6;
  --blue: #0a7180;
}

/* Mirror the Local IME's per-script font tags inside the plain textarea. */
@font-face {
  font-family: "Tangliengim Hanri SC";
  src: local("Noto Sans SC"), local("Noto Sans CJK SC"), local("Microsoft YaHei");
  unicode-range: U+3A7C;
}

@font-face {
  font-family: "Tangliengim Hanri";
  src: local("Noto Sans TC"), local("Noto Sans CJK TC"), local("Microsoft JhengHei");
  unicode-range: U+3400-4DBF, U+4E00-9FFF, U+20000-2EBEF;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "TLI Western Punctuation", Calibri, "Segoe UI", Arial, sans-serif;
}

.ime-shell {
  width: min(100% - 28px, 980px);
  margin: 0 auto;
  padding: 24px 0 28px;
}

.ime-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: #ffffff;
  color: #0c1d30;
  font-family: "TLI Western Punctuation", "Tangliengim Hangul", "Noto Sans TC", "Noto Sans CJK TC", "Noto Sans KR", sans-serif;
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 0.94;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.brand-mark span {
  font-family: "TLI Western Punctuation", "Tangliengim Hangul", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1;
}

.pad {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  overflow: hidden;
}

.pad-label {
  display: block;
  padding: 14px 16px 10px;
  color: #506176;
  font-size: 0.86rem;
  font-style: italic;
  font-weight: 800;
}

.text-wrap {
  position: relative;
  border-top: 1px solid #e4ebf3;
}

.ime-tone-overlay,
.ime-text {
  display: block;
  width: 100%;
  min-height: min(48vh, 360px);
  padding: 16px 48px 16px 16px;
  border: 0;
  outline: 0;
  resize: vertical;
  color: var(--text);
  font-family: "TLI Western Punctuation", "Tangliengim Hangul", "TLI Extended Hanri", "Tangliengim Hanri Fallback", "Tangliengim Hanri SC", "Tangliengim Hanri", "Noto Sans KR", "Noto Sans CJK KR", "Noto Sans", "Malgun Gothic", "Segoe UI", sans-serif;
  font-size: 26px;
  line-height: 1.42;
}

.ime-tone-overlay {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 3;
  overflow: hidden;
  resize: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.ime-text {
  position: relative;
  z-index: 2;
  background: transparent;
  caret-color: rgba(8, 117, 107, 0.78);
}

.text-wrap.native-composition-active .ime-tone-overlay {
  visibility: hidden;
}

.android-keyboard {
  margin: 14px auto 0;
  font-size: 14px;
  text-align: center;
}

.android-keyboard a {
  color: var(--accent);
  font-weight: 700;
}

.mobile-web-ime .keyboard-guide-button,
.mobile-web-ime .keyboard-guide {
  display: none !important;
}

/* Keep the guide on screen by giving it space from the input while it is open. */
.pad.keyboard-guide-open .ime-text {
  min-height: clamp(192px, calc(100dvh - 630px), 300px);
}

.ime-text::placeholder {
  color: #a5b0be;
  -webkit-text-fill-color: #a5b0be;
  font-family: "TLI Western Punctuation", Calibri, "Segoe UI", Arial, sans-serif;
  font-size: inherit;
  line-height: inherit;
}

.clear-button {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #718096;
  cursor: pointer;
  font-size: 1.7rem;
  line-height: 1;
  z-index: 3;
}

.clear-button:hover {
  background: #edf3fa;
  color: #31445a;
}

.normalization-suggestions {
  max-height: 132px;
  overflow-y: auto;
  padding: 6px 16px 8px;
  border-top: 1px solid #e4ebf3;
  color: #506176;
  font-size: 0.9rem;
  line-height: 1.6;
}

.normalization-suggestion {
  margin: 0;
  overflow-wrap: anywhere;
}

.normalization-target {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.normalization-target:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.lomari-preview {
  min-height: calc(1.45em + 16px);
  max-height: calc(4.35em + 16px);
  padding: 8px 16px;
  overflow-y: auto;
  border-top: 1px solid #e4ebf3;
  border-bottom: 1px solid #e4ebf3;
  background: #f7faf9;
  color: #667386;
  font-family: "TLI Western Punctuation", "TLI Noto Sans", sans-serif;
  font-size: 1.08rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 14px;
  padding: 13px 14px;
}

.toolbar-actions,
.sandhi-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tool-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  line-height: 1;
}

.tool-button:hover,
.tool-button:focus-visible {
  border-color: #b8d7de;
  background: #e7f4f6;
  outline: none;
}

.tool-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 700px) {
  .ime-tone-overlay, .ime-text { font-size: 24px; }
  .tool-button { height: 44px; }
}

.tool-icon {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-tool .tool-icon {
  width: 26px;
  height: 26px;
}

.audio-tool .stop-icon,
.audio-tool.playing .audio-icon {
  display: none;
}

.audio-tool.playing {
  color: #9f1239;
}

.audio-tool.playing .stop-icon {
  display: block;
}

.sandhi-label {
  color: #435469;
  font-size: 0.95rem;
  font-weight: 800;
}

.sandhi-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #c2d0e0;
  border-radius: 7px;
  background: #ffffff;
  color: #31516f;
  cursor: pointer;
  font-family: "TLI Western Punctuation", Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 0.98rem;
  font-weight: 850;
}

.sandhi-button.active {
  border-color: #b8d7de;
  background: #e7f4f6;
  color: var(--blue);
}

.sandhi-button:hover,
.sandhi-button:focus-visible {
  border-color: rgba(29, 112, 215, 0.45);
}

/* Singapore takes the site red used for its varying tones (shared/web-site-navigation.css). */
.sandhi-button.active[data-sandhi-choice="singapore"] {
  border-color: #f0c89a;
  background: #fdf1e3;
  color: var(--site-voice, #b33b46);
}

.status-line {
  flex: 1 1 220px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

.keyboard-guide-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #c2d0e0;
  border-radius: 7px;
  background: #ffffff;
  color: #31516f;
  cursor: pointer;
  font-family: "TLI Western Punctuation", Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
}

.keyboard-guide-button:hover,
.keyboard-guide-button:focus-visible,
.keyboard-guide-button[aria-expanded="true"] {
  border-color: rgba(8, 117, 107, 0.45);
  background: #e7f4f6;
  color: var(--blue);
  outline: none;
}

.guide-chevron {
  color: #718096;
  font-size: 0.72rem;
}

.keyboard-guide {
  padding: 13px 10px 15px;
  overflow-x: auto;
  border-top: 1px solid #e4ebf3;
  background: #fbfcfe;
}

.keyboard-layout {
  --guide-key-width: 48px;
  --guide-key-gap: 6px;
  --guide-shift-width: 48px;
  --guide-apostrophe-width: 44px;
  display: grid;
  justify-content: center;
  gap: var(--guide-key-gap);
  min-width: 410px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: var(--guide-key-gap);
}

.keyboard-row-bottom {
  /* Keep X centered between S and D, like a staggered QWERTY keyboard. */
  transform: translateX(calc((var(--guide-apostrophe-width) - var(--guide-shift-width) - var(--guide-key-width) - var(--guide-key-gap)) / 2));
}

.keyboard-row-top-controls {
  position: relative;
  width: 534px;
}

.keyboard-row-top-controls .key-backspace {
  position: absolute;
  top: 0;
  right: 0;
}

.keyboard-key {
  position: relative;
  display: grid;
  width: var(--guide-key-width);
  height: var(--guide-key-width);
  flex: 0 0 var(--guide-key-width);
  place-items: center;
  padding: 3px;
  border: 1px solid #d2d9e2;
  border-radius: 3px;
  background: #ffffff;
  color: #202124;
  cursor: pointer;
  font-family: "TLI Western Punctuation", Calibri, "Segoe UI", Arial, sans-serif;
  touch-action: manipulation;
}

.keyboard-key:hover,
.keyboard-key:focus-visible {
  border-color: #9db9de;
  background: #f8fbff;
  outline: none;
}

.keyboard-key.pressed,
.keyboard-key.modifier-active {
  border-color: var(--blue);
  background: #dbeafe;
}

.key-input {
  align-self: start;
  color: #737d8a;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.keyboard-key:not(.tone-key) .key-input {
  color: #aab3bd;
}

.tone-key .key-input {
  color: #aab3bd;
}

.key-output {
  align-self: start;
  margin-top: -1px;
  font-family: "TLI Western Punctuation", "Tangliengim Hangul", "Noto Sans KR", "Noto Sans CJK KR", Calibri, sans-serif;
  font-size: 1.12rem;
  line-height: 1;
}

.keyboard-layout:not(.romanisation-hints) .keyboard-key:not(.tone-key) .key-output {
  transform: translateY(1px);
}

.tone-key .key-output {
  font-family: "TLI Western Punctuation", Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 1.5rem;
  transform: translateY(4px);
}

.keyboard-row-space {
  position: relative;
  width: 534px;
}

.keyboard-guide-options {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  color: #46566a;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.keyboard-guide-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.guide-mode-switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: #cbd0d7;
  transition: background-color 160ms ease;
}

.guide-mode-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px #00000026;
  transition: transform 160ms ease;
}

.keyboard-guide-options input:checked + .guide-mode-switch {
  background: #34c759;
}

.keyboard-guide-options input:checked + .guide-mode-switch::after {
  transform: translateX(14px);
}

.keyboard-guide-options input:focus-visible + .guide-mode-switch {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .guide-mode-switch,
  .guide-mode-switch::after {
    transition: none;
  }
}

.key-romanisation {
  display: none;
  pointer-events: none;
}

.romanisation-hints .key-romanisation {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  color: #202124;
  font-size: 0.9375rem;
  line-height: 1;
  text-align: center;
  transform: translateY(1.5px);
}

.romanisation-hints .keyboard-key:not(.tone-key) .key-output {
  position: absolute;
  top: 3px;
  right: 4px;
  margin: 0;
  color: #46566a;
  font-size: 0.875rem;
}

.romanisation-hints .keyboard-key:not(.tone-key) .key-input {
  position: absolute;
  top: 3px;
  left: 4px;
  margin: 0;
}

.control-key {
  color: #46566a;
  font-size: 1.1rem;
  font-weight: 800;
}

.key-shift,
.key-apostrophe,
.key-backspace {
  height: 48px;
}

.key-shift {
  width: var(--guide-shift-width);
  flex-basis: var(--guide-shift-width);
}

.key-apostrophe {
  width: var(--guide-apostrophe-width);
  flex-basis: var(--guide-apostrophe-width);
}

.key-backspace {
  width: 92px;
  flex-basis: 92px;
  font-size: 0.92rem;
}

.key-space {
  width: 190px;
  height: 28px;
  flex: 0 0 190px;
}

.key-apostrophe {
  font-family: "TLI Western Punctuation", "Google Sans", "Product Sans", "Noto Sans", "Segoe UI", Arial, sans-serif;
}

.hangul-tone {
  position: relative;
  display: inline-block;
  min-width: 0;
  line-height: 1.15;
  ruby-position: over;
}

.hangul-tone .tone-mark {
  position: absolute;
  top: calc(-0.84em - 4px);
  left: 50%;
  transform: translateX(-50%);
  color: #1f2937;
  font-family: "TLI Western Punctuation", Calibri, Arial, sans-serif;
  font-size: 1.02em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.tone-overlay-anchor {
  position: absolute;
  width: 0;
  height: 0;
}

.tone-overlay-mark {
  position: absolute;
  top: calc(-0.72em - 2px);
  left: 1px;
  width: max-content;
  transform: translateX(-50%);
  color: #1f2937;
  font-family: "TLI Western Punctuation", Calibri, Arial, sans-serif;
  font-size: 1.02em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 10;
  transform: translate(-50%, 12px);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 640px) {
  .tone-overlay-mark {
    top: calc(-0.72em - 4px);
  }

  .keyboard-layout {
    --guide-key-width: calc((100vw - 58px) / 10);
    --guide-key-gap: 3px;
    --guide-shift-width: 48px;
  }

  .ime-shell {
    width: min(100% - 18px, 980px);
    padding-top: 14px;
  }

  .ime-header,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .ime-text {
    min-height: 44vh;
  }

  .status-line {
    text-align: left;
  }

  .keyboard-guide-button {
    align-self: stretch;
  }

  .keyboard-guide {
    padding-inline: 5px;
  }

  .keyboard-layout {
    min-width: 0;
  }

  .keyboard-row {
    gap: var(--guide-key-gap);
  }

  .keyboard-row-top-controls {
    width: calc(100vw - 31px);
  }

  .keyboard-key:not(.control-key) {
    width: var(--guide-key-width);
    height: 44px;
    flex-basis: var(--guide-key-width);
  }

  .key-input {
    font-size: 0.68rem;
  }

  .key-output {
    font-size: 0.98rem;
  }

  .key-space {
    width: min(42vw, 160px);
    flex-basis: min(42vw, 160px);
  }

  .key-shift {
    width: var(--guide-shift-width);
    height: 44px;
    flex-basis: var(--guide-shift-width);
  }

  .key-apostrophe {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .key-backspace {
    width: 76px;
    height: 44px;
    flex-basis: 76px;
  }
}
