/* =============================================================
   아등바등 스튜디오 — 화면 스타일
   종이 위에 적은 노트 같은 톤. 모바일 퍼스트.
   ============================================================= */

:root {
  --paper: #f6f1e8;
  --paper-2: #efe7da;
  --card: #fffdf8;
  --ink: #1a1613;
  --ink-2: #3b332c;
  --muted: #7d7266;
  --line: #e4dacb;
  --line-strong: #d3c5b2;
  --accent: #e8613c;
  --accent-deep: #c94a28;
  --accent-soft: #fbe7e0;
  --green: #4d7c62;
  --shadow: 0 1px 2px rgba(26, 22, 19, 0.04), 0 8px 24px rgba(26, 22, 19, 0.06);
  --radius: 16px;
  --radius-sm: 11px;
  --tabbar-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR",
    "Pretendard", "Malgun Gothic", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Noto Serif KR", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14110f;
    --paper-2: #1c1815;
    --card: #1f1b18;
    --ink: #f3ece2;
    --ink-2: #ded4c7;
    --muted: #a99c8c;
    --line: #332c26;
    --line-strong: #473d35;
    --accent: #f07a56;
    --accent-deep: #ff9673;
    --accent-soft: #3a231c;
    --green: #7fb695;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--paper);
  color-scheme: light dark;
}

body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

a {
  color: var(--accent-deep);
}

.muted {
  color: var(--muted);
}

.hint {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

.screen {
  min-height: 100dvh;
}

/* ---------------- 브랜드 마크 ---------------- */

.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  width: 34px;
  height: 34px;
  padding: 7px 6px 6px;
  border-radius: 10px;
  background: var(--ink);
  flex: none;
}

.brand-mark i {
  display: block;
  width: 4px;
  border-radius: 3px;
  background: var(--paper);
}

.brand-mark i:nth-child(1) {
  height: 10px;
}
.brand-mark i:nth-child(2) {
  height: 15px;
}
.brand-mark i:nth-child(3) {
  height: 20px;
  background: var(--accent);
}
.brand-mark::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
}

.brand-mark-sm {
  width: 30px;
  height: 30px;
  padding: 6px 5px 5px;
  border-radius: 9px;
}
.brand-mark-sm i {
  width: 3.5px;
}
.brand-mark-sm i:nth-child(1) {
  height: 8px;
}
.brand-mark-sm i:nth-child(2) {
  height: 12px;
}
.brand-mark-sm i:nth-child(3) {
  height: 16px;
}

.brand-mark-lg {
  width: 56px;
  height: 56px;
  padding: 12px 10px 10px;
  border-radius: 16px;
}
.brand-mark-lg i {
  width: 7px;
}
.brand-mark-lg i:nth-child(1) {
  height: 16px;
}
.brand-mark-lg i:nth-child(2) {
  height: 24px;
}
.brand-mark-lg i:nth-child(3) {
  height: 32px;
}

/* ---------------- 로딩 ---------------- */

.screen-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}

/* ---------------- 인증 ---------------- */

.screen-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}

.auth-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 22px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.auth-title {
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: -0.02em;
}

.auth-sub {
  font-size: 13px;
  text-align: center;
  margin-bottom: 4px;
}

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-error {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  color: var(--accent-deep);
}

.pin-input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  letter-spacing: 0.4em;
  font-size: 19px;
  text-align: center;
}

.pin-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------------- 앱 프레임 ---------------- */

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

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

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text p {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 16px;
  color: var(--ink-2);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fade-in 0.18s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px;
}

.section-head {
  padding: 2px 4px 0;
}

.section-head h2 {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.02em;
}

.section-head p {
  margin-top: 4px;
  font-size: 13px;
}

.section-title {
  margin: 20px 0 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title:first-child {
  margin-top: 0;
}

/* ---------------- 탭 바 ---------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.tab-btn {
  flex: 1;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.tab-ico {
  font-size: 17px;
  line-height: 1;
}

.tab-btn.is-active {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

/* ---------------- 입력 ---------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
}

input[type="text"],
input[type="url"],
input[type="search"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: 16px; /* iOS 확대 방지 */
  line-height: 1.45;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

textarea {
  resize: vertical;
  min-height: 44px;
}

.composer {
  padding: 12px 12px 12px;
}

.composer-input {
  border: none;
  border-bottom: 1px dashed transparent;
  background: transparent;
  padding: 6px 4px 10px;
  font-size: 17px;
  line-height: 1.55;
  min-height: 56px;
  max-height: 40vh;
}

.composer-input:focus {
  box-shadow: none;
  border-color: var(--line-strong);
}

.composer-input::placeholder {
  color: var(--muted);
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.tool-btn {
  height: 38px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  font-size: 15px;
  color: var(--ink-2);
}

.tool-btn-wide {
  font-size: 12.5px;
  font-weight: 600;
  padding: 0 10px;
}

.tool-btn.is-live {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.6;
  }
}

.composer-tools .btn {
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: transform 0.06s ease, background 0.15s;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-primary:disabled {
  opacity: 0.55;
}

.btn-ghost {
  background: var(--paper);
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.btn-danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent-deep);
}

.btn-block {
  width: 100%;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid transparent;
}

.chip-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-on {
  background: var(--accent);
  color: #fff;
}

.pill-quiet {
  background: transparent;
  border: 1px solid var(--line);
}

/* ---------------- 사진 ---------------- */

.photo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 4px 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.photo-preview img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  flex: none;
}

.photo-preview-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.attach-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
}

/* ---------------- 검색 · 태그 ---------------- */

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-row input {
  background: var(--card);
}

.tag-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 2px 2px;
  scrollbar-width: none;
}

.tag-filters::-webkit-scrollbar {
  display: none;
}

.tag-filter {
  flex: none;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.tag-filter b {
  font-weight: 700;
  opacity: 0.7;
}

.tag-filter.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---------------- 타임라인 ---------------- */

.thought-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.day-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-label {
  position: sticky;
  top: calc(54px + env(safe-area-inset-top));
  z-index: 5;
  align-self: flex-start;
  margin: 0 0 0 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.day-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.thought {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 8px;
  box-shadow: var(--shadow);
}

.thought-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.thought-top time {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.thought-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 700;
}

.thought-body {
  font-size: 15px;
  line-height: 1.62;
  white-space: normal;
  overflow-wrap: anywhere;
}

.thumb {
  display: block;
  margin: 9px 0 4px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  line-height: 0;
  max-width: 100%;
}

.thumb img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

.quote {
  margin: 10px 0 4px;
  padding: 10px 12px 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--paper);
  border-radius: 0 10px 10px 0;
}

.quote p {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
}

.quote cite {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
}

.source-line {
  margin: 8px 0 2px;
  font-size: 12px;
  color: var(--muted);
}

.link-card {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 9px 0 2px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  border-radius: 0 10px 10px 0;
  background: var(--paper);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
}

.link-host {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--accent-deep);
}

.link-url {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thought-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.thought-foot .chip {
  min-height: 26px;
  font-size: 11.5px;
  color: var(--muted);
}

.empty {
  padding: 26px 10px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------------- 스크립트 ---------------- */

.pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pick-head h3 {
  font-size: 14px;
}

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  max-height: 320px;
  overflow-y: auto;
}

.pick-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  cursor: pointer;
}

.pick-item.is-picked {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pick-item input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: none;
}

.pick-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pick-text b {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}

.pick-text small {
  font-size: 11px;
}

.script-editor .editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.section-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  margin-top: 10px;
  background: var(--paper);
}

.section-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.time {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.section-card .field + .field {
  margin-top: 8px;
}

.section-card textarea {
  background: var(--card);
  font-size: 14.5px;
  line-height: 1.65;
}

.row-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.row-actions .btn {
  flex: 1;
}

.script-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.script-refs {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
}

.script-refs h3 {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.script-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
}

.script-row:last-child {
  border-bottom: none;
}

.script-row-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.script-row-text b {
  font-size: 13.5px;
  font-weight: 600;
}

.script-row-text small {
  font-size: 11px;
}

.script-row-actions {
  display: flex;
  gap: 4px;
  flex: none;
}

.empty-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding: 24px 16px;
}

/* ---------------- 제작 팩 ---------------- */

.lang-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--paper-2);
  border-radius: 12px;
  margin-bottom: 12px;
}

.lang-tab {
  flex: 1;
  min-height: 36px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.lang-tab.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.pack-card h3 {
  font-family: var(--serif);
  font-size: 20px;
  margin: 2px 0 10px;
  overflow-wrap: anywhere;
}

.pack-lang {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.thumb-copy {
  position: relative;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
}

.thumb-copy p {
  margin: 3px 0 0;
  padding-right: 46px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
}

.thumb-copy .chip {
  position: absolute;
  right: 8px;
  bottom: 8px;
}

.pack-script {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pack-section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.pack-section-head b {
  font-size: 13.5px;
}

.pack-section p {
  font-size: 14px;
  line-height: 1.7;
  white-space: normal;
  overflow-wrap: anywhere;
}

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

.diagram-root {
  align-self: flex-start;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 800;
}

.diagram-branches {
  list-style: none;
  margin: 0 auto 0 0;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.diagram-branches li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 4px;
}

.diagram-branches li::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 9px;
  width: 13px;
  height: 2px;
  background: var(--line-strong);
}

.branch-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-2);
}

.branch-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ref-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------------- 라이트박스 ---------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(12, 10, 9, 0.92);
  backdrop-filter: blur(4px);
}

.lightbox img {
  max-width: 100%;
  max-height: 88dvh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 17px;
}

/* ---------------- 모달 ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 14, 12, 0.45);
}

.sheet {
  position: relative;
  width: min(560px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.22);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  animation: slide-up 0.22s ease-out;
}

@keyframes slide-up {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
}

.sheet-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
  font-family: var(--serif);
  font-size: 19px;
}

.sheet-body {
  padding: 14px 16px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.sheet-actions .btn {
  flex: 1;
}

/* ---------------- 토스트 ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  z-index: 70;
  transform: translateX(-50%);
  max-width: calc(100% - 36px);
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.18s ease-out;
}

.toast-error {
  background: var(--accent-deep);
  color: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* ---------------- 큰 화면 ---------------- */

@media (min-width: 720px) {
  body {
    font-size: 15.5px;
  }
  .main {
    padding-left: 22px;
    padding-right: 22px;
  }
  .composer-input {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
