/* 아이캔KOMO — studio tokens. D 2026-09-11 */

:root {
  --studio: #f4f6f8;
  --plate: #ffffff;
  --well: #eceef1;
  --stage-light: #fafbfc;
  --chip-on: #e8eaed;
  --ink: #0f172a;
  --muted: #5a6a80;
  --faint: #6b778c;
  --line: rgba(15, 23, 42, 0.10);
  --charcoal: #2a2e35;
  --on-tag: #f7f7f8;
  --navy: #1e3a5f;
  --navy-deep: #152a45;
  --on-primary: #ffffff;
  --coral: #c2410c;
  --focus: #0f172a;

  --r-sm: 8px;
  --r-md: 14px;
  --r-plate: 32px;
  --r-well: 20px;
  --r-pill: 999px;

  --shadow-plate:
    0 0 0 1px rgba(15, 23, 42, 0.04),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 20px rgba(15, 23, 42, 0.05),
    0 24px 48px rgba(15, 23, 42, 0.06);
  --shadow-thumb:
    0 0 0 1px rgba(15, 23, 42, 0.05),
    0 2px 8px rgba(15, 23, 42, 0.06);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --font: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo",
    "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --fs-tag: 12px;
  --fs-hint: 13px;
  --fs-ui: 14px;
  --fs-body: 16px;

  --header-h: 52px;
  --rail-w: 280px;
  --plate-w: 400px;
  --glyph: 128px;
  --hit: 44px;

  --ease-enter: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-move: cubic-bezier(0.25, 1, 0.5, 1);
  --duration-press: 120ms;
  --duration-hover: 150ms;
  --scale-press: 0.96;

  --z-base: 0;
  --z-raised: 10;
  --z-sticky: 30;
  --z-overlay: 40;
  --z-tooltip: 70;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden]:not(.glyph-well):not(#maker-well) {
  display: none !important;
}

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 8px);
}

html,
body {
  margin: 0;
  min-height: 100dvh;
}

body,
.app {
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  background: var(--studio);
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-wrap: pretty;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a,
button,
[type="button"],
[type="submit"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
.brand,
.tab,
.maker-label,
.maker-kicker,
.glyph-name,
.korean-line,
.empty-copy,
.error-copy {
  text-wrap: balance;
  word-break: keep-all;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: var(--z-tooltip);
  transform: translateY(-160%);
  padding: 0 14px;
  min-height: var(--hit);
  display: inline-flex;
  align-items: center;
  background: var(--plate);
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-thumb);
  font-size: var(--fs-ui);
  font-weight: 650;
}

.skip:focus {
  transform: none;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header — dense chrome, same studio floor */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-h);
  padding-top: env(safe-area-inset-top);
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: 0;
  padding-left: max(16px, env(safe-area-inset-left));
  background: var(--studio);
  border-bottom: 1px solid var(--line);
}

.brand {
  margin: 0;
  min-width: min-content;
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
}

.brand-latin {
  font-family: inherit;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.03em;
  color: inherit;
}

.tabs {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: var(--space-1);
  min-width: min-content;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--hit);
  padding: 0 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-ui);
  font-weight: 500;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  white-space: nowrap;
}

.tab.is-on,
.tab[aria-current="page"] {
  color: var(--ink);
  font-weight: 650;
  border-bottom-color: var(--charcoal);
}

/* Shell */

.shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.shell > * {
  min-width: 0;
}

#main {
  scroll-margin-top: calc(var(--header-h) + env(safe-area-inset-top) + 8px);
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-4)
    calc(var(--space-6) + env(safe-area-inset-bottom));
  background:
    radial-gradient(
      ellipse 80% 55% at 50% 38%,
      var(--stage-light) 0%,
      var(--studio) 70%
    );
}

/* 장면 줄 — 모음집. 판과 같은 너비, 가운데. 세 번째 흰 판 아님. 재생·진행·모션 없음. */
.film {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: min(100%, var(--plate-w));
  max-width: 100%;
  min-width: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.film > .maker-kicker {
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
}

.film-track {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  padding: 4px; /* 2px 링 + 2px offset. overflow-y hidden이 선택을 자르지 않게 */
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  touch-action: pan-x;
}

/* 박자가 바로 자식일 때 — 가로 줄 */
.film:not(:has(.film-track)) {
  flex-flow: row nowrap;
  align-items: center;
  justify-content: flex-start;
  padding: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  touch-action: pan-x;
}

.film-beat {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: var(--plate);
  border: 0;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-thumb);
  flex-shrink: 0;
}

.film-beat .glyph-well {
  width: 40px;
  height: 40px;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.film-beat .glyph,
.film-beat .glyph-well > .glyph,
.film-beat .glyph-well > img {
  width: 40px;
  height: 40px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.film-beat[aria-pressed="true"] {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.film-beat:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* 판은 #stage 안에 있다. 스테이지 자식이 수축하면 카드 100%가 내용 너비가 된다. 필름과 같은 --plate-w. */
#stage {
  width: min(100%, var(--plate-w));
  min-width: 0;
}

/* Studio plate */

.studio-card {
  width: min(100%, var(--plate-w));
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px 28px 28px;
  background: var(--plate);
  border-radius: var(--r-plate);
  box-shadow: var(--shadow-plate);
}

.glyph {
  width: var(--glyph);
  height: var(--glyph);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
}

.glyph-name {
  margin: 0;
  font-size: var(--fs-ui);
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
  color: var(--ink);
}

.glyph-well {
  display: grid;
  place-items: center;
  width: var(--glyph);
  height: var(--glyph);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: var(--r-well);
  background: var(--well);
}

/* Empty maker well stays a 1:1 frame. [hidden] belongs on the img, never the well. */
#maker-well.glyph-well {
  display: grid;
  width: var(--glyph);
  height: var(--glyph);
  aspect-ratio: 1 / 1;
}

#maker-well.glyph-well[hidden] {
  display: grid !important;
}

.glyph-well > img,
.glyph-well > .glyph {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.studio-card.is-loading .glyph-well {
  animation: well-pulse 1.2s var(--ease-move) infinite;
}

@keyframes well-pulse {
  50% { opacity: 0.45; }
}

.studio-card.is-empty {
  min-height: 240px;
}

/* Tags — charcoal pills. Signature. */

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  max-width: 100%;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  background: var(--charcoal);
  color: var(--on-tag);
  border: 0;
  border-radius: var(--r-pill);
  font-size: var(--fs-tag);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

button.tag:not([data-tag-remove]),
a.tag,
.tag.is-action {
  min-height: var(--hit);
  padding: 0 14px;
}

/* Extra tags stay the 28px charcoal pill. 44 would break the signature. */
button.tag[data-tag-remove] {
  position: relative;
  min-height: 28px;
  padding: 4px 12px;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  cursor: pointer;
}

button.tag[data-tag-remove]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: var(--hit);
  transform: translateY(-50%);
}

/* Tag add — one row on the plate. Not a second white plate. */
.tag-add {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  align-self: stretch;
  gap: var(--space-2);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.tag-add > .maker-input {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: var(--hit);
  font-size: var(--fs-body);
}

.tag-add > .dl {
  flex: 0 0 auto;
  min-height: var(--hit);
  min-width: var(--hit);
  white-space: nowrap;
}

/* Rail — collection rows */

.rail {
  order: 2;
  border-top: 1px solid var(--line);
  padding: var(--space-2) var(--space-3)
    calc(var(--space-4) + env(safe-area-inset-bottom));
  background: var(--studio);
}

.rail-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 64px;
  margin: 0;
  padding: var(--space-2);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--r-md);
  color: inherit;
  text-decoration: none;
}

.rail-row + .rail-row {
  margin-top: var(--space-1);
}

.rail-thumb {
  width: 56px;
  height: 56px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--plate);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-thumb);
}

.rail-thumb .glyph-well {
  width: 40px;
  height: 40px;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.rail-thumb .glyph,
.rail-thumb .glyph-well > .glyph,
.rail-thumb .glyph-well > img {
  width: 40px;
  height: 40px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.rail-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.rail-row .tags {
  justify-content: flex-start;
}

.rail-row .tag {
  min-height: 24px;
  padding: 3px 8px;
}

.rail-row.is-on,
.rail-row[aria-pressed="true"] {
  background: var(--plate);
  box-shadow: var(--shadow-thumb);
}

.rail-find {
  padding: var(--space-2) var(--space-2) var(--space-3);
}

/* Shelf plate: 저장 · 고치기 · 그림 다시. Same muted weight. Not navy. */
.stage-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  gap: var(--space-4);
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.stage-actions > .dl {
  min-height: var(--hit);
  min-width: var(--hit);
  flex: 0 0 auto;
  white-space: nowrap;
  max-width: 100%;
}

.dl {
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: var(--fs-hint);
  font-weight: 650;
  line-height: 1.45;
  text-decoration: none;
  min-height: var(--hit);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  cursor: pointer;
}

button.dl {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: var(--fs-hint);
  font-weight: 650;
  line-height: 1.45;
  color: var(--muted);
}

button.dl:focus-visible,
a.dl:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.prompt-box {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 12px 14px;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-hint);
  line-height: 1.45;
}

.maker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.maker-actions .btn-primary {
  flex: 1;
  min-width: 8em; /* 그리기 · 다시 그리기 같은 폭 */
}

/* Maker */

.maker {
  width: min(100%, var(--plate-w));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.maker-label {
  display: block;
  font-size: var(--fs-ui);
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.maker-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.maker-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.maker-pair .maker-row {
  min-width: 0;
}

/* 책 · 주체 · 서술어 · 객체 · 곳·때. 같은 스튜디오. 흰 판을 겹치지 않는다. */
.maker-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  background: transparent;
}

.maker-block + .maker-block {
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

/* 책 — 만들기 맨 위. 다음이 숨은 아이콘 행이라 이웃 헤어라인을 이 칸이 진다. */
#book-block {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
}

.book-head {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.book-head > .maker-kicker {
  flex: 0 0 auto;
  min-width: 0;
}

#quota-line {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 0 0 auto;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#book-block .maker-actions {
  width: 100%;
}

#book-block .btn-ghost {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
}

/* 주체·서술어·객체: 44 우물 + 이름 입력. 두 폭 모두 가로. */
.maker-slot {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.maker-slot > .slot {
  flex: 0 0 var(--hit);
}

.maker-slot > .maker-input {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: var(--hit);
}

/* 슬롯 = 작은 우물. 흰 판 없음. 시작 배지 없음. 선택만 잉크 링. */
.slot {
  display: grid;
  place-items: center;
  width: var(--hit);
  height: var(--hit);
  min-width: var(--hit);
  min-height: var(--hit);
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.slot .glyph-well {
  width: var(--hit);
  height: var(--hit);
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r-sm);
  background: var(--well);
}

.slot .glyph-well > img:not([hidden]),
.slot .glyph-well > .glyph:not([hidden]) {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.slot[aria-pressed="true"] {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.slot:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.maker-kicker {
  margin: 0;
  max-width: 100%;
  font-size: var(--fs-tag);
  font-weight: 600;
  line-height: 1.3;
  color: var(--muted);
  word-break: keep-all;
  text-wrap: balance;
}

.korean-line {
  margin: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 3em;
  font-size: var(--fs-body);
  font-weight: 650;
  line-height: 1.5;
  color: var(--ink);
  text-align: center;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.korean-line:empty {
  display: none;
  min-height: 0;
}

.maker-input {
  width: 100%;
  min-height: var(--hit);
  min-width: 0;
  padding: 0 14px;
  background: var(--well);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-body);
  line-height: 1.4;
}

.maker-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.maker-input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  background: var(--plate);
}

textarea.maker-input.book-text {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 88px; /* 두 줄. 패딩 12 + 본문 */
  resize: vertical;
  padding: 12px 14px;
  font-size: var(--fs-body);
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
  background: var(--well);
  box-shadow: none;
}

.maker-hint {
  margin: 0;
  font-size: var(--fs-hint);
  line-height: 1.45;
  color: var(--muted);
}

.maker-types {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  min-width: 0;
  width: 100%;
}

.maker-block > .maker-types {
  flex: 0 0 auto;
  width: 100%;
}

.maker-block > .maker-slot {
  flex: 0 0 auto;
  width: 100%;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--hit);
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-ui);
  font-weight: 500;
  white-space: nowrap;
}

.chip.is-on,
.chip[aria-pressed="true"] {
  background: var(--chip-on);
  color: var(--ink);
  font-weight: 650;
  border-color: transparent;
}

/* Buttons — navy only on 그리기 / 다시 그리기 */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--hit);
  padding: 0 18px;
  background: var(--navy);
  color: var(--on-primary);
  border: 0;
  border-radius: var(--r-md);
  font-size: var(--fs-ui);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 8em; /* 그리기 · 다시 그리기. 라벨이 바뀌어도 폭이 뛰지 않는다 */
  transition:
    background-color var(--duration-hover) ease,
    transform var(--duration-press) var(--ease-enter);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--plate);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--navy);
}

.btn-primary:active {
  transform: scale(var(--scale-press));
}

.btn-primary:disabled,
.btn-primary[aria-disabled="true"],
.btn-primary[aria-busy="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--hit);
  padding: 0 16px;
  background: var(--plate);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-ui);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--duration-hover) ease,
    transform var(--duration-press) var(--ease-enter);
}

.btn-ghost:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.btn-ghost:active {
  transform: scale(var(--scale-press));
}

.btn-ghost:disabled,
.btn-ghost[aria-disabled="true"],
.btn-ghost[aria-busy="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Empty / error */

.empty,
.error {
  width: min(100%, var(--plate-w));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}

.empty-copy,
.error-copy {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--muted);
}

.error {
  color: var(--coral);
}

.error-copy {
  color: var(--coral);
  font-weight: 500;
}

/* Views */

/* 문장 만들기는 #comp-rail을 모음집 레일과 같이 둔다. 아이콘·유리만 숨김. */
[data-view="maker"]:not([data-type="sentence"]) #comp-rail {
  display: none;
}

[data-view="gallery"] .maker {
  display: none;
}

.app[data-type="sentence"] [data-mode="icon"] {
  display: none;
}

.app:not([data-type="sentence"]) [data-mode="sentence"] {
  display: none;
}

/* Hover — fine pointer only */

@media (hover: hover) and (pointer: fine) {
  .tab:hover {
    color: var(--ink);
  }

  .rail-row:hover {
    background: rgba(255, 255, 255, 0.72);
  }

  .rail-row.is-on:hover {
    background: var(--plate);
  }

  .btn-primary:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--navy-deep);
  }

  .btn-ghost:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--well);
  }

  .chip:hover {
    border-color: rgba(15, 23, 42, 0.18);
    color: var(--ink);
  }

  .dl:hover {
    color: var(--ink);
  }

  .film-beat:hover {
    outline: 1px solid rgba(15, 23, 42, 0.18);
    outline-offset: 2px;
  }

  .film-beat[aria-pressed="true"]:hover {
    outline: 2px solid var(--ink);
  }
}

/* Desktop */

@media (max-width: 879px) {
  .header {
    gap: 8px;
  }
  .tabs {
    margin-left: auto;
    flex-shrink: 0;
  }
  .tab {
    padding: 0 10px;
    font-size: 13px;
  }
}

@media (max-width: 359px) {
  .tab {
    padding: 0 8px;
  }

  .maker-pair {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 880px) {
  :root {
    --glyph: 160px;
    --header-h: 56px;
  }

  .header {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }

  .tab {
    padding: 0 14px;
  }

  .shell {
    flex-direction: row;
    align-items: stretch;
  }

  .rail {
    order: 0;
    width: var(--rail-w);
    flex: 0 0 var(--rail-w);
    border-top: 0;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-3) var(--space-3)
      calc(var(--space-5) + env(safe-area-inset-bottom));
  }

  .stage {
    justify-content: center;
    padding: var(--space-7) var(--space-6);
  }

  .studio-card {
    min-height: 320px;
    padding: 48px 32px 32px;
  }

  .maker-row {
    flex-direction: row;
    align-items: stretch;
    gap: var(--space-2);
  }

  .maker-pair .maker-row,
  .maker-block > .maker-row {
    flex-direction: column;
    align-items: stretch;
  }

  .book-head {
    flex-direction: row;
    align-items: baseline;
  }

  .maker-slot {
    flex-direction: row;
    align-items: center;
  }

  .maker-input {
    flex: 1;
  }

  .maker-types {
    flex: 1;
    width: auto;
  }

  .maker-block > .maker-types {
    flex: 0 0 auto;
    width: 100%;
  }

  .maker-block > .maker-slot {
    flex-direction: row;
    align-items: center;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-press: 0.01ms;
    --duration-hover: 0.01ms;
  }

  .studio-card.is-loading .glyph-well {
    animation: none;
    opacity: 0.7;
  }

  .btn-primary:active,
  .btn-ghost:active {
    transform: none;
  }
}
