:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --card: #fdfcf8;
  --ink: #242521;
  --soft: #68675e;
  --rule: #d8d5ca;
  --brick: #803725;
  --brickHi: #662919;
  --tint: #f1e8dd;
  --dark: #292b28;
  --serif:
    'Baskervville', 'Iowan Old Style', 'AppleMyungjo', 'Yu Mincho',
    'Noto Serif CJK KR', 'Batang', Georgia, serif;
  --ui:
    'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
    'Malgun Gothic', 'Yu Gothic', Arial, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 var(--ui);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
button,
textarea,
input,
select {
  font: inherit;
  color: inherit;
}
button,
select,
a {
  touch-action: manipulation;
}
button,
select {
  cursor: pointer;
}
button {
  background: none;
  border: 0;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #ba783f;
  outline-offset: 3px;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button,
select {
  font-weight: 550;
}
.icon {
  width: 1.15em;
  height: 1.15em;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
  flex: none;
}
.mast {
  border-bottom: 1px solid var(--rule);
  background: #fcfbf7;
}
.mast-inner,
main,
footer {
  width: min(1280px, calc(100% - 8vw));
  margin: auto;
}
.mast-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 50px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.15em;
  color: var(--ink);
  font:
    600 1.8rem/0.98 'Baskervville',
    'Iowan Old Style',
    Georgia,
    serif;
  text-decoration: none;
  letter-spacing: -0.06em;
  white-space: nowrap;
}
.brand img {
  margin-right: 7px;
}
.brand i {
  font-weight: 500;
}
nav {
  display: flex;
  align-self: stretch;
  gap: 26px;
}
nav button {
  font-size: 0.91rem;
  padding: 5px 1px 0;
  color: var(--soft);
  border-bottom: 2px solid transparent;
}
nav button[aria-current='page'] {
  color: var(--brick);
  border-color: var(--brick);
  font-weight: 700;
}
.global {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
}
.select-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--card);
  font-size: 0.91rem;
}
.select-box:after {
  content: '';
  position: absolute;
  right: 12px;
  top: calc(50% - 4px);
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 1.4px 1.4px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
.select-box > span {
  position: absolute;
  left: 11px;
  display: flex;
  pointer-events: none;
}
select {
  background: transparent;
  border: 0;
  appearance: none;
  border-radius: inherit;
  padding: 8px 32px 8px 12px;
  width: 100%;
  min-height: 38px;
}
select option {
  color: #262721;
  background: #faf9f5;
}
.select-box > span + select {
  padding-left: 35px;
}
.global-select {
  border: 0;
  background: transparent;
}
.help-icon,
.square {
  display: inline-grid;
  place-items: center;
  color: var(--soft);
  padding: 8px;
  border-radius: 5px;
  min-width: 36px;
  min-height: 36px;
}
.help-icon:hover,
.square:hover {
  background: #eae6dd;
}
main {
  min-height: calc(100vh - 180px);
  padding: 45px 0 42px;
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 32px;
}
h1 {
  font: 600 clamp(2.35rem, 4vw, 3.5rem)/1.13 var(--serif);
  letter-spacing: -0.072em;
}
html[lang='en'] h1 {
  letter-spacing: -0.052em;
  font-weight: 520;
}
.intro p,
.lead {
  margin-top: 12px;
  color: var(--soft);
  line-height: 1.7;
}
.action,
.btn {
  border: 1px solid var(--rule);
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  padding: 9px 15px;
  min-height: 42px;
  font-weight: 650;
  font-size: 0.92rem;
}
.action {
  background: var(--brick);
  color: #fff8ef;
  border-color: var(--brick);
  padding: 11px 18px;
  min-height: 45px;
}
.action:hover:not(:disabled) {
  background: var(--brickHi);
}
.btn:hover:not(:disabled) {
  background: #f1eee5;
}
.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.82fr) minmax(290px, 1fr);
  gap: 22px;
  align-items: start;
}
.editor,
.palette,
.dict-card,
.answer-card {
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 12px;
}
.editor {
  overflow: hidden;
}
.mode-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--rule);
  background: #fcfbf7;
}
.mode-tabs button,
.filters button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 37px;
  border-radius: 5px;
  color: var(--soft);
  padding: 5px 15px;
  font-size: 0.94rem;
}
.mode-tabs button[aria-pressed='true'] {
  color: var(--brick);
  background: #efe6da;
  font-weight: 700;
}
.mode-tabs button:hover,
.filters button:hover {
  background: #f1eee7;
}
.plate {
  background-color: var(--dark);
  color: #f5eddb;
  isolation: isolate;
  position: relative;
  padding: 23px 25px 15px;
  overflow: hidden;
}
.plate:before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.65;
  background:
    radial-gradient(ellipse at 50% 115%, #5a5b4b40, transparent 65%),
    radial-gradient(#cac0a02c 0.68px, transparent 0.8px);
  background-size:
    auto,
    13px 13px;
}
.plate:after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.15;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath filter='url(%23n)' opacity='.42' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
}
.plate-bottom,
.output-head,
.section-head,
.dialog-top,
.dict-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.inscription {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  align-items: center;
  gap: clamp(4px, 1vw, 18px);
  padding: 22px 10px;
  min-height: 193px;
  margin: 10px 0;
}
.glyph {
  font-family: ExileGlyphs, sans-serif;
  font-style: normal;
  font-weight: 400;
  font-variant: normal;
  line-height: 1;
  display: inline-block;
}
.inscription .glyph {
  font-size: clamp(4.3rem, 7.4vw, 7.3rem);
  color: #f2e6ca;
  text-shadow: 0 1px 1px #000;
}
.inscription[data-long='true'] .glyph {
  font-size: clamp(2.75rem, 4.8vw, 4.7rem);
}
.plate-bottom {
  border-top: 1px solid #e1dac326;
  padding-top: 10px;
  min-height: 32px;
  font-size: 0.84rem;
  color: #d2cdbd;
}
.plate-tools {
  display: flex;
  align-items: center;
  gap: 9px;
}
.plate-tools button {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #ece5d5;
  font-size: 0.82rem;
  padding: 5px;
}
.plate-tools button:hover:not(:disabled) {
  color: white;
  text-decoration: underline;
}
.plate-empty {
  font-size: 0.95rem;
  color: #c4c1b3;
}
.output {
  padding: 22px 25px 25px;
}
.output-head h2,
.section-head h2,
.answer-card h2 {
  font-size: 1.05rem;
  letter-spacing: -0.035em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.output-head h2 .icon,
.section-head h2 .icon {
  color: var(--brick);
}
.output-text {
  font-size: clamp(1.35rem, 2.1vw, 1.8rem);
  font-weight: 580;
  letter-spacing: -0.045em;
  margin-top: 15px;
  line-height: 1.5;
}
.output-text.empty {
  font-size: 1rem;
  color: var(--soft);
  font-weight: 400;
}
.gloss {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}
.gloss span {
  font-size: 0.84rem;
  color: #5f5c51;
  background: #eeeae0;
  border-radius: 4px;
  padding: 3px 8px;
}
.note {
  font-size: 0.875rem;
  color: var(--soft);
  line-height: 1.6;
}
.output .note {
  margin-top: 9px;
}
.palette {
  padding: 22px 20px;
}
.section-head {
  margin-bottom: 15px;
}
.count {
  border: 1px solid var(--rule);
  border-radius: 30px;
  color: var(--soft);
  font-size: 0.8rem;
  padding: 1px 8px;
}
.filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.filters button {
  border-radius: 25px;
  min-height: 32px;
  padding: 3px 12px;
  border: 1px solid transparent;
  font-size: 0.86rem;
}
.filters button[aria-pressed='true'] {
  background: var(--dark);
  color: #fcf9ee;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.tile {
  position: relative;
  background: #f6f3e9;
  border: 1px solid #ded9c9;
  box-shadow: 0 1px 1px #4430190a;
  border-radius: 6px;
  min-width: 0;
  min-height: 76px;
  padding: 7px 2px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
}
.tile:nth-child(3n) {
  background: #f3f0e5;
}
.tile .glyph {
  font-size: 2.33rem;
  color: #33352d;
}
.tile .meaning {
  font-size: 0.83rem;
  font-weight: 560;
  color: #514e43;
}
.tile:hover:not(:disabled) {
  border-color: #a97862;
  background: #f1e5d4;
}
.tile:active:not(:disabled) {
  transform: translateY(1px);
}
.tile .plus {
  display: none;
  position: absolute;
  right: 5px;
  top: 0;
  color: var(--brick);
}
.tile:hover .plus,
.tile:focus-visible .plus {
  display: block;
}
.palette .note {
  font-size: 0.85rem;
}
.tile-more {
  display: block;
  width: 100%;
  margin-top: 12px;
  text-align: center;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--soft);
  min-height: 36px;
  font-size: 0.88rem;
}
.tile-more:hover {
  background: #f5f2e9;
}
.write-area {
  padding: 20px 25px;
  background: #faf8f1;
  border-bottom: 1px solid var(--rule);
}
.write-area label,
.field-label {
  font-size: 0.93rem;
  font-weight: 650;
}
textarea,
.field {
  border: 1px solid #c8c4b9;
  background: #fffefa;
  border-radius: 6px;
  padding: 11px 13px;
  width: 100%;
  font-size: 1rem;
}
textarea {
  display: block;
  resize: vertical;
  min-height: 74px;
  margin: 10px 0;
}
.write-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.write-tools .btn {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
  min-height: 37px;
  padding: 6px 13px;
}
.error {
  color: #9b3625;
  font-size: 0.9rem;
  margin-top: 8px;
}
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--soft);
  border-top: 1px solid var(--rule);
  padding: 20px 0 26px;
  font-size: 0.84rem;
}
footer div {
  display: flex;
  align-items: center;
  gap: 11px;
}
.footer-word {
  font:
    italic 1.1rem Georgia,
    serif;
  color: #514f43;
}
footer button {
  font-size: 0.84rem;
  color: var(--soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--card);
  padding: 0 13px;
  max-width: 420px;
}
.search .field {
  border: 0;
  background: transparent;
}
.dict-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 16px;
}
.dict-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
}
.dict-card {
  padding: 16px 18px;
}
.dict-card .glyph {
  font-size: 3rem;
}
.dict-card h2 {
  font-size: 1rem;
}
.dict-card p {
  color: var(--soft);
  font-size: 0.875rem;
  margin-top: 5px;
}
dialog {
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  width: min(480px, calc(100% - 32px));
  padding: 24px;
  max-height: 88dvh;
  box-shadow: 0 20px 80px #15140e30;
}
dialog::backdrop {
  background: #1c211e80;
  backdrop-filter: blur(2px);
}
.dialog-top {
  margin-bottom: 15px;
}
.dialog-top h2 {
  font: 600 1.58rem var(--serif);
  letter-spacing: -0.05em;
}
.dialog-top .square {
  font-size: 1.2rem;
}
.option-row {
  display: flex;
  text-align: left;
  gap: 13px;
  align-items: center;
  border: 1px solid var(--rule);
  background: #f9f7f0;
  border-radius: 8px;
  padding: 13px;
  width: 100%;
  margin-top: 9px;
}
.option-row:hover {
  border-color: #997561;
}
.option-row > .icon {
  width: 21px;
  height: 21px;
  color: var(--brick);
}
.option-row b,
.option-row small {
  display: block;
}
.option-row small {
  font-size: 0.83rem;
  font-weight: 400;
  color: var(--soft);
  margin-top: 2px;
}
.dialog-copy {
  line-height: 1.7;
}
.dialog-copy p + p,
.dialog-copy p + ul {
  margin-top: 12px;
}
.dialog-copy ul {
  padding-left: 1.3em;
}
.dialog-copy a {
  color: var(--brick);
}
#toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 14px);
  opacity: 0;
  transition:
    opacity 0.18s,
    transform 0.18s;
  background: #292c25;
  color: #fffaf1;
  border-radius: 9px;
  padding: 10px 17px;
  box-shadow: 0 3px 12px #0002;
  pointer-events: none;
  max-width: 90vw;
  font-size: 0.94rem;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
#export-status:not(:empty) {
  margin-top: 12px;
}
:root {
  --paper: #f2eee4;
  --card: #fffdf6;
  --ink: #272920;
  --soft: #635f52;
  --rule: #d3c9b6;
  --brick: #794424;
  --brickHi: #5c341c;
  --tint: #eee3cc;
  --dark: #182522;
}
.mast {
  background: #15201e;
  border-bottom: 2px solid #927148;
  color: #f8edcf;
}
.mast .brand {
  color: #fbefd7;
}
.mast nav button,
.mast .global-select,
.mast .help-icon {
  color: #dcd4be;
}
.mast nav button[aria-current='page'] {
  color: #f3d29a;
  border-color: #c19a65;
}
.mast .help-icon:hover {
  background: #34413a;
}
main {
  padding-top: 25px;
}
.temple-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #14201c url('assets/temple-wall.webp') center 50% / cover
    no-repeat;
  color: #fbecd1;
  border: 1px solid #4a402c;
  border-radius: 10px;
  min-height: clamp(160px, 17vw, 225px);
  padding: 30px clamp(18px, 3.3vw, 53px);
  margin-bottom: 18px;
}
.temple-hero:after {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid #b49a6336;
  border-radius: 4px;
  pointer-events: none;
  z-index: -1;
}
.hero-text {
  position: relative;
  z-index: 1;
  width: min(58%, 650px);
}
.temple-hero h1 {
  font-weight: 550;
  font-size: clamp(2.15rem, 4.15vw, 3.9rem);
  text-shadow: 0 2px 14px #080a08;
}
.temple-hero p {
  color: #e0d5bd;
  font-size: clamp(0.94rem, 1.2vw, 1.04rem);
  margin-top: 10px;
  text-shadow: 0 1px 6px #10130d;
}
.wall-inscription {
  position: absolute;
  right: 1.45%;
  width: 14.6%;
  top: 50%;
  transform: translateY(-50%) rotate(-0.6deg);
  display: grid;
  gap: clamp(4px, 1vw, 13px);
  justify-items: center;
  color: #5d371e;
  mix-blend-mode: multiply;
  opacity: 0.95;
}
.wall-inscription > div {
  display: flex;
  justify-content: center;
  gap: 1px;
}
.wall-inscription .glyph {
  font-size: clamp(16px, 2.9vw, 43px);
  text-shadow:
    0 -1px 1px #371f16,
    0 1px 1px #fbdc99;
}
.plate {
  background: #182622;
  color: #f3e7c9;
  background-image: linear-gradient(110deg, #0f1d1b, #22312b 60%, #18251e);
  box-shadow: inset 0 0 0 1px #b4976659;
  padding-block: 14px 10px;
}
.plate:before {
  opacity: 0.82;
  background-image:
    radial-gradient(ellipse at 50% 110%, #98825625, transparent 72%),
    linear-gradient(to right, #a78a5d14 1px, transparent 1px),
    linear-gradient(to bottom, #a78a5d14 1px, transparent 1px);
  background-size:
    auto,
    32px 32px,
    32px 32px;
}
.plate:after {
  opacity: 0.26;
}
.plate .inscription {
  min-height: 132px;
  margin: 3px 0;
}
.inscription .glyph {
  color: #efdbaf;
  text-shadow:
    0 1px 1px #0e100a,
    0 0 16px #c9964222;
}
.plate-bottom {
  padding-top: 5px;
}
.plate-tools button {
  min-height: 34px;
}
.write-area {
  padding: 13px 22px 14px;
  background: var(--card);
}
.write-area label .icon {
  color: var(--brick);
}
.write-area textarea {
  min-height: 49px;
  margin: 8px 0 0;
  resize: vertical;
}
.output {
  padding-bottom: 13px;
}
.output-text {
  margin-top: 6px;
}
.share-row {
  padding: 0 24px 18px;
}
.share-row .action {
  min-height: 38px;
  padding: 8px 14px;
}
.palette-search {
  margin: 10px 0 0;
}
.palette-search .field {
  font-size: 0.93rem;
  padding: 7px 0;
}
.palette .filters {
  gap: 0;
}
.palette .filters button {
  padding: 4px 8px;
}
.palette .section-head {
  margin-bottom: 8px;
}
.mobile-palette-btn {
  display: none;
}
.tile {
  background: linear-gradient(135deg, #f8f3e5, #eee8d7);
  border-color: #d7c8a9;
}
.tile:nth-child(3n) {
  background: linear-gradient(135deg, #f6eedc, #eee6d3);
}
.tile .glyph {
  color: #333528;
}
.recovery-links {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}
.recovery-links button {
  color: var(--brick);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.recovery-option {
  border-top: 1px solid var(--rule);
  margin-top: 7px;
  padding-top: 5px;
}
.sheet-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 9px;
  padding: 6px 10px;
  background: #20312b;
  border-radius: 5px;
  color: #ead6ae;
}
.sheet-strip > div {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.sheet-strip .glyph {
  font-size: 1.65rem;
}
.sheet-strip > span {
  font-size: 0.85rem;
  white-space: nowrap;
}
.sheet-done {
  position: sticky;
  bottom: 0;
  display: block;
  width: 100%;
  margin-top: 12px;
  box-shadow: 0 -4px 9px #f9f6e9;
}
.sheet-count {
  font-size: 0.85rem;
  color: var(--soft);
  margin: 0 0 7px;
}
:root{--ui:"Pretendard",-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Malgun Gothic",system-ui,sans-serif}
html[lang=ko] h1,html[lang=ko] .dialog-top h2{font-family:var(--ui);font-weight:680;letter-spacing:-.046em}
html[lang=ko] .temple-hero h1{font-weight:630}

/* The desk and the dictionary share the same reading width at every screen size. */
:root {
  --handset: 520px;
  --gutter: clamp(12px, 3.7vw, 19px);
  background: #e7e3d8;
}
body {
  width: min(100%, var(--handset));
  min-height: 100dvh;
  margin-inline: auto;
  box-shadow: 0 0 0 1px #4e463815;
}
.mast-inner, main, main.workshop-view, footer {
  width: calc(100% - var(--gutter) * 2);
}
.mast-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(4px, 1.6vw, 9px);
  min-height: 58px;
}
.brand {
  font-size: clamp(1.08rem, 4.9vw, 1.45rem);
  gap: .14em;
}
.brand img {
  width: 29px;
  height: 29px;
  margin-right: 3px;
}
.mast nav {
  justify-content: center;
  gap: 2px;
  min-width: 0;
}
.mast nav button {
  min-width: 44px;
  font-size: .85rem;
  white-space: nowrap;
  padding: 4px clamp(3px, 1vw, 7px) 2px;
  min-height: 44px;
}
.mast .global { gap: 0; margin: 0; }
.global-select > span { display: none; }
.global-select:after { right: 5px; }
.global-select > span + select {
  padding: 4px 18px 4px 3px;
  min-height: 44px;
  font-size: .83rem;
}
.mast .help-icon {
  min-height: 42px;
  min-width: 32px;
  padding: 4px;
}
main, main.workshop-view {
  min-height: calc(100dvh - 132px);
  padding: 14px 0 26px;
}
.intro {
  display: block;
  margin: 8px 0 17px;
}
h1 { font-size: clamp(1.7rem, 6vw, 2rem); }
.intro p { margin-top: 6px; font-size: .94rem; }
.temple-hero, .workshop-view .temple-hero {
  display: flex;
  aspect-ratio: 3 / 1;
  min-height: 96px;
  padding: 14px var(--gutter);
  margin: 0 0 12px;
  border-radius: 8px;
  background-size: 100% 100%;
}
.temple-hero .hero-text { width: 68%; }
.temple-hero h1 { font-size: clamp(1.35rem, 5.3vw, 1.92rem); }
.temple-hero p {
  margin-top: 4px;
  font-size: clamp(.81rem, 3.05vw, .96rem);
  line-height: 1.45;
}
.wall-inscription { gap: clamp(2px, 1vw, 5px); }
.wall-inscription .glyph { font-size: clamp(12px, 4vw, 18px); }
.work-grid, .workshop-view .work-grid { display: block; }
.editor { border-radius: 9px; }
.plate { padding: 12px 14px 6px; }
.output-head { gap: 8px; }
.output-head > * { min-width: 0; }
.plate .inscription {
  min-height: 83px;
  margin: 3px 0 5px;
  padding: 13px 6px;
  gap: 4px;
}
.inscription .glyph { font-size: clamp(3.2rem, 12vw, 4.15rem); }
.inscription[data-long='true'] .glyph { font-size: clamp(2.05rem, 7.8vw, 2.65rem); }
.plate-empty { font-size: .89rem; line-height: 1.45; text-align: center; }
.plate-bottom { min-height: 43px; padding-top: 2px; }
.plate-tools {
  flex-wrap: wrap;
  max-width: 100%;
  gap: 0 3px;
}
.plate-tools button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 4px;
  gap: 3px;
  white-space: nowrap;
}
.desk-actions, .board-input-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
}
.desk-actions .mobile-palette-btn, .board-input-tools .mobile-palette-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 7px 4px;
  border: 1px solid #c9bba1;
  border-radius: 6px;
  background: #f5eddc;
  color: #4f3a25;
  font-size: .92rem;
  font-weight: 670;
  line-height: 1.25;
}
.desk-actions .mobile-palette-btn:hover, .board-input-tools .mobile-palette-btn:hover { background: #eadfc9; }
.desk-actions > .select-box, .desk-actions label { min-width: 0; }
.desk-actions select { min-height: 44px; text-overflow: ellipsis; }
.board-slot {
  position: relative;
  display: grid;
  place-items: center;
  color: inherit;
  min-width: 44px;
  min-height: 48px;
  padding: 4px 2px;
  border: 1px solid transparent;
  border-radius: 6px;
}
.board-slot:hover { background: #e8d6ab0c; }
.board-slot[aria-pressed='true'] {
  border-color: #d2b67d;
  background: #d6b36919;
}
.board-slot[aria-pressed='true']::after {
  content: '';
  position: absolute;
  inset-inline-end: -3px;
  inset-block: 10%;
  width: 3px;
  border-radius: 3px;
  background: #ebc889;
}
.plate-tools [aria-pressed='true'] { color: #f6cf8b; }
.inline-picker {
  padding: 14px;
  border-bottom: 1px solid var(--rule);
}
.inline-picker .search { max-width: none; }
.inline-picker .field, .inline-picker #pal-query {
  min-height: 44px;
  font-size: 16px;
}
.inline-picker .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.inline-picker .tile {
  min-height: 76px;
  padding: 5px 2px;
  gap: 2px;
  line-height: 1.12;
}
.inline-picker .tile .glyph { font-size: 2.08rem; }
.inline-picker .tile .meaning { font-size: .82rem; }
.inline-picker .all-signs {
  display: block;
  min-height: 44px;
  margin: 5px auto 0;
  padding: 6px 14px;
  color: var(--brick);
}
.inline-picker .tiles { margin-top: 8px; }
.inline-picker .tile small { color: var(--soft); font-size: .75rem; }
.select-box select { min-height: 40px; }
.entry-add, .btn, .action, .square { min-height: 44px; }
.tiles, #dialog[data-panel='palette'] .tiles { grid-template-columns: repeat(4,minmax(0,1fr)); }
.filters button { min-height: 40px; }
.tile { min-height: 65px; }
.tile-more { min-height: 43px; }
.search { max-width: none; }
.field, textarea { font-size: 16px; }
.search .field { min-width: 0; }
dialog, body dialog.ocr-dialog {
  max-width: calc(var(--handset) - 16px);
  width: calc(100% - 16px);
  max-height: 90dvh;
  padding: 16px;
  overscroll-behavior: contain;
}
#dialog[data-panel='palette'] {
  width: min(var(--handset),100%);
  max-width: var(--handset);
  margin: auto auto 0;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom));
  max-height: 86dvh;
  border-radius: 13px 13px 0 0;
}
.dialog-top { gap: 10px; margin-bottom: 10px; }
.dialog-top h2 { font-size: 1.25rem; }
.ocr-dialog .ocr-candidates { grid-template-columns: repeat(4,minmax(0,1fr)); }
.sheet-done { bottom: -1px; }
footer {
  min-height: 68px;
  padding: 13px 0 max(16px,env(safe-area-inset-bottom));
  font-size: .79rem;
}
footer > div { flex-direction: column; align-items: flex-start; gap: 1px; }
footer .footer-links {
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  column-gap: 10px;
}
.footer-links a, .footer-links button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--soft);
  font-size: .84rem;
}
.footer-links a { text-underline-offset: 3px; }
@media (max-width: 365px) {
  .mast .brand img { width: 24px; height: 24px; margin-right: 1px; }
  .mast .brand { font-size: 1.04rem; }
  .mast nav { gap: 0; }
  .mast nav button { padding-inline: 3px; font-size: .79rem; }
  html[lang='en'] .mast nav button { min-width: 36px; }
  .mast .help-icon { min-width: 27px; }
  #reading .gloss-list li { column-gap: 5px; }
  .desk-actions, .board-input-tools { gap: 5px; padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.inscription:has(.board-slot) {
  --slot-width: clamp(3.65rem, 16vw, 4.75rem);
  align-items: stretch;
  row-gap: 10px;
}
.inscription[data-long='true'] { --slot-width: clamp(3.35rem, 14vw, 4.35rem); }
.plate .board-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 var(--slot-width);
  min-width: 0;
}
.slot-meaning {
  max-width: 100%;
  color: #f5e5c8;
  font: 500 .86rem/1.3 var(--ui);
  text-align: center;
  overflow-wrap: anywhere;
}
/* Keep every glyph in place while the word underneath it is concealed. */
.plate[data-revealed='false'] .slot-meaning { visibility: hidden; }
.plate[data-revealed='false'] .board-example,
.plate[data-revealed='true'] .slot-order { display: none; }
.slot-order {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.board-example {
  margin: 4px 0 12px;
  color: #ffedc8;
  text-align: center;
}
.plate-bottom {
  flex-wrap: wrap;
  gap: 2px 10px;
  padding-block: 10px 8px;
}
.plate-tools {
  margin-inline-start: auto;
  justify-content: flex-end;
}
.plate-tools button { min-width: 44px; }
.board-export, .board-reveal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px;
  border-radius: 6px;
  font: 650 .89rem/1.25 var(--ui);
}
.board-export {
  flex: none;
  padding-inline: 13px;
  border: 1px solid #ddc592;
  border-radius: 999px;
  color: #312b1f;
  background: #eddbb6;
  box-shadow: 0 3px 8px #10191370;
}
.board-export:hover { background: #fae9c8; }
.board-export:active { box-shadow: 0 1px 3px #10191360; }
@media (max-width: 600px) {
  #dialog[data-panel='export'] {
    width: min(100%, var(--handset));
    max-width: 100%;
    margin: auto auto 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    border-radius: 14px 14px 0 0;
  }
}
.board-reveal {
  width: fit-content;
  margin: 0 auto 4px;
  padding-inline: 8px;
  white-space: nowrap;
  color: #ffe4b4;
  font-size: .85rem;
}

@media (max-width: 600px) {
  /* Clip the board art without making either ancestor a scroll container. */
  .editor:has(.board-slot:nth-child(17)),
  #board:has(.board-slot:nth-child(17)) { overflow: clip; }
  #board:has(.board-slot:nth-child(17)) .plate-bottom {
    position: sticky;
    bottom: env(safe-area-inset-bottom, 0px);
    z-index: 2;
    background: #25312a;
  }
}
