:root {
  color-scheme: light;
  --page: #f3f0e8;
  --surface: #faf8f1;
  --ink: #292d28;
  --muted: #5f6257;
  --line: #bdb9ab;
  --green: #4b5838;
  --leaf: #e5e6d8;
  --serif: "Nanum Myeongjo", "Noto Serif CJK KR", "Noto Serif KR", "AppleMyungjo", "Batang", serif;
  font-family: "Noto Sans CJK KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, textarea, select, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .65; cursor: wait; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .world:focus-visible { outline: 3px solid #75a784; outline-offset: 3px; }
[data-icon] { display: inline-grid; place-items: center; flex: 0 0 auto; }
[data-icon] svg { width: 1.15em; height: 1.15em; vertical-align: middle; }
.header-inner, .layout { width: min(calc(100% - clamp(28px, 5vw, 80px)), 1440px); margin-inline: auto; }
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}
.brand, .space-tabs button, .mine-link, .icon-button { border: 0; background: transparent; }
.brand { justify-self: start; padding: 0; font: 600 clamp(22px, 2.3vw, 32px) / 1.5 var(--serif); }
.space-tabs { display: flex; gap: clamp(18px, 3vw, 44px); }
.space-tabs button { min-height: 44px; padding: 6px 8px; border-bottom: 2px solid transparent; font: 600 17px var(--serif); }
.space-tabs button[aria-current] { border-bottom-color: var(--green); }
.space-tabs button:hover, .mine-link:hover { color: var(--green); text-decoration: underline; text-underline-offset: 5px; }
.header-tools { display: flex; justify-content: end; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; font-size: 19px; }
.icon-button:hover, .outline:hover { background: var(--leaf); }
.layout { padding-bottom: 18px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: clamp(20px, 3.4vh, 38px) 4px; }
h1, h2, p { margin: 0; }
h1 { font: 600 clamp(28px, 3.3vw, 48px) / 1.35 var(--serif); letter-spacing: -.035em; }
#space-tag { margin-top: 4px; color: var(--muted); font-size: 14px; }
.mine-link { min-height: 44px; padding: 0 4px; white-space: nowrap; font: 500 17px var(--serif); }
.experience { position: relative; }
.world {
  isolation: isolate;
  position: relative;
  height: clamp(360px, 68svh, 820px);
  overflow: hidden;
  background: radial-gradient(ellipse at 55% 18%, #818f64, #264c39 56%, #122c22);
  color: #f7f9ed;
}
.terrain, .terrain canvas, .world-shade { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.world-shade { pointer-events: none; background: linear-gradient(0deg,#04112277,transparent 16%); }
.world-controls { display: flex; align-items: end; justify-content: space-between; position: absolute; bottom: 17px; left: 17px; right: 17px; pointer-events: none; gap: 10px; }
.world-controls button, .joystick { pointer-events: auto; }
.key-guide { display: flex; align-items: center; gap: 4px; font-size: 13px; padding-bottom: 5px; }
.key-guide kbd { display: inline-grid; place-items: center; border: 1px solid #f5fad852; border-radius: 4px; background: #1c392cbe; width: 24px; height: 25px; font-size: 12px; }
.key-guide span { margin-left: 4px; }
.world-action {
  position: absolute;
  right: 20px;
  bottom: 20px;
  min-height: 48px;
  padding: 10px 24px;
  border: 1px solid #d7d1c0;
  border-radius: 5px;
  background: var(--page);
  color: var(--ink);
  font: 600 18px var(--serif);
}
.world-action:hover { background: #fffdf5; }
.effect-skip { position: absolute; top: 17px; right: 17px; padding: 9px 12px; color: #f8f9ee; border: 1px solid #eff4d363; border-radius: 5px; background: #1a392ecc; }
.echo-sky { position: absolute; inset: 0; pointer-events: none; }
.echo-star { position: absolute; transform: translate(-50%, -50%); border: 0; width: 54px; height: 54px; border-radius: 50%; background: transparent; pointer-events: auto; }
.echo-star::after { content: attr(data-hint); position: absolute; top: 72%; left: 50%; transform: translateX(calc(-50% + var(--hint-shift, 0px))); width: max-content; padding: 5px 8px; border-radius: 5px; color: #eef3fa; background: #101f32ed; font-size: 12px; line-height: 1.4; font-weight: 500; opacity: 0; pointer-events: none; }
.echo-star:focus-visible { outline: 1px solid #cfddf0aa; outline-offset: -12px; z-index: 1; }
.echo-star:focus-visible::after { opacity: 1; }
@media (hover: hover) { .echo-star:hover { z-index: 1; } .echo-star:hover::after { opacity: 1; } }
.star-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.star-item { width: 100%; display: grid; gap: 4px; padding: 10px 12px; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: #f5f8ef; color: var(--ink); overflow-wrap: anywhere; }
.star-item:hover { border-color: var(--green); }
.compose-modes { display: flex; gap: 8px; margin-bottom: 14px; }
#voice-draft { margin-bottom: 16px; }
audio { display: block; width: 100%; max-width: 100%; margin: 10px 0; }

.actor-label { position: absolute; transform: translate(-50%, -100%); padding: 1px 8px 2px; border-radius: 99px; font-size: 12px; background: #13291acc; pointer-events: none; }
.shout { text-align: center; position: absolute; left: 50%; top: 22%; transform: translateX(-50%); max-width: min(72%, 520px); border-radius: 13px; background: #14372ce8; padding: 12px 18px; font-weight: 700; overflow-wrap: anywhere; border: 1px solid #f2f5cb91; box-shadow: 0 4px 16px #001c17aa; animation: appear .3s ease-out; pointer-events: none; }
@keyframes appear { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
.joystick { display: none; position: relative; border: 1px solid #f5fad880; width: 74px; height: 74px; border-radius: 50%; background: #133226a0; touch-action: none; }
.joystick i { position: absolute; left: 22px; top: 22px; width: 28px; height: 28px; border-radius: 50%; background: #f8ffe0a8; transform: translate(var(--jx, 0px),var(--jy, 0px)); }
@media (pointer: coarse) { .key-guide { display: none; } .joystick { display: block; } }
.world.text-mode .joystick, .world.text-mode .key-guide { display: none; }
.fallback { display: grid; place-content: center; text-align: center; position: absolute; inset: 0; gap: 10px; }
.fallback span { font-size: 52px; color: #e1ebc0; }
.fallback p { font-size: 17px; font-weight: 650; }
.panel-icon { width: 39px; height: 39px; border-radius: 11px; background: #e5e6d8; color: #356345; font-size: 20px; }
.button { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; min-height: 43px; padding: 8px 12px; border-radius: 9px; border: 1px solid transparent; font-size: 15px; font-weight: 700; }
.solid { background: var(--green); color: #f8faf1; }
.solid:hover { background: #2e6249; }
.outline { border-color: var(--line); background: #f9fbf5; }
.footnote { font-family: var(--serif); color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 17px; }
dialog { width: min(calc(100% - 26px), 530px); max-height: min(calc(100% - 24px), 800px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 25px 80px #06180d5b; }
dialog::backdrop { background: #112a22a8; }
.dialog-body { position: relative; padding: clamp(19px, 4vw, 27px); }
.dialog-body h2 { margin: 8px 0 13px; font-size: 24px; }
.dialog-close { position: absolute; top: 15px; right: 15px; }
textarea { display: block; resize: vertical; width: 100%; min-height: 94px; max-height: 200px; border-radius: 10px; padding: 10px 12px; line-height: 1.55; border: 1px solid #cad8c8; color: var(--ink); background: #f6f8f1; }
textarea::placeholder { color: #64786a; }
.character-count { text-align: right; font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.character-count.over, .error { color: #922f24; }
.visibility { border: 0; margin: 0 0 10px; padding: 0; }
.visibility legend { padding: 0 0 6px; font-size: 14px; font-weight: 700; }
.visibility label { display: flex; align-items: center; gap: 9px; background: #fff; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin: 5px 0; cursor: pointer; }
.visibility label:has(:checked) { background: #edf4e9; border-color: #91a987; }
.visibility label strong { font-size: 14px; }
.visibility label small { display: block; color: var(--muted); font-size: 13px; }
.visibility label > [data-icon] { margin-left: auto; color: #557a5c; }
input[type=radio], input[type=checkbox] { accent-color: #356043; }
.notice, .error { font-size: 14px; line-height: 1.53; margin: 9px 0 13px; }
.notice { color: var(--muted); }
.dynamic { display: grid; gap: 12px; }
.reader-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.echo-body { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #f0f5eb; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.reaction-list { display: flex; gap: 7px; flex-wrap: wrap; }
.pill { background: #f6f8f2; border: 1px solid var(--line); color: #2e543a; border-radius: 7px; padding: 6px 9px; font-size: 14px; }
button.pill[aria-pressed=true] { background: #dfefdc; border-color: #78a77b; font-weight: 650; }
button.pill:hover { background: #eaf0e6; }
.reader-actions, .mine-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.reader-actions .button, .mine-actions .button { width: auto; min-height: 36px; }
.entry { display: grid; gap: 9px; border: 1px solid var(--line); background: #f6f8f2; border-radius: 10px; padding: 12px; }
.entry + .entry { margin-top: 2px; }
.entry-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.entry-meta { color: var(--muted); font-size: 13px; }
.danger { color: #922f24; }
.settings-list { display: grid; gap: 12px; }
.settings-list label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.settings-list input { width: 20px; height: 20px; }
.settings-list select { padding: 6px 8px; background: #f5f8f1; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.toast { position: fixed; z-index: 2; bottom: 18px; left: 50%; width: max-content; max-width: calc(100% - 26px); padding: 10px 15px; border-radius: 10px; transform: translateX(-50%); color: #f5f9ee; background: #1f4b36; box-shadow: 0 3px 15px #153b2e4b; font-size: 15px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.paper-dialog {
  width: min(calc(100% - 24px), 540px);
  max-height: calc(100dvh - 28px);
  border-radius: 5px;
  background: var(--page);
  box-shadow: 0 12px 48px #24261c30;
}
.paper-dialog::backdrop { background: #24261c85; }
.paper-dialog .dialog-body { padding: clamp(20px, 4vw, 34px); }
.paper-dialog h2 {
  margin: 0 0 18px;
  padding: 0 40px 16px 0;
  border-bottom: 1px solid var(--line);
  font: 600 clamp(24px, 4vw, 32px) / 1.35 var(--serif);
  letter-spacing: -.035em;
}
.paper-dialog h3 { font: 600 19px / 1.5 var(--serif); margin: 6px 0 0; }
.paper-dialog .notice { line-height: 1.65; word-break: keep-all; }
.compose-modes, .reader-filters { gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.compose-modes button.pill, .reader-filters button.pill {
  min-height: 44px;
  padding: 4px 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}
.compose-modes button[aria-pressed=true], .reader-filters button[aria-pressed=true] { color: var(--ink); border-bottom-color: var(--green); }
.paper-dialog textarea { background: var(--surface); border-color: var(--line); border-radius: 3px; font: 17px / 1.8 var(--serif); padding: 14px; }
.paper-dialog .button, .paper-dialog .pill { border-radius: 4px; }
.paper-dialog .outline, .paper-dialog .pill { background: var(--surface); }
.paper-dialog .reaction-list button[aria-pressed=true] { background: var(--leaf); border-color: var(--green); }
.visibility label { border-radius: 3px; background: var(--surface); border-color: var(--line); }
.visibility label:has(:checked) { background: var(--leaf); border-color: var(--green); }
.paper-dialog .entry, .paper-dialog .echo-body { background: transparent; border: 0; border-radius: 0; padding: 12px 0; }
.paper-dialog .entry + .entry { border-top: 1px solid var(--line); }
.paper-dialog .entry-text, .paper-dialog .echo-body { font: 18px / 1.8 var(--serif); }
.reader-mine-link { display: block; margin: 18px 0 0 auto; min-height: 44px; border: 0; background: transparent; text-decoration: underline; text-underline-offset: 4px; color: var(--muted); font-size: 14px; }
#star-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 14px 0; }
.star-choice { display: grid; align-content: center; gap: 2px; min-height: 58px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); font: 600 15px var(--serif); }
.star-choice:hover { border-color: var(--green); }
.star-choice[aria-pressed=true] { background: var(--green); color: var(--surface); }
.star-choice[aria-pressed=true] small { color: inherit; }
.star-item { background: var(--surface); border-radius: 3px; }
@media (max-width: 360px) {
  #star-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .header-inner { grid-template-columns: 1fr auto; padding-top: 6px; }
  .header-tools { grid-column: 2; grid-row: 1; }
  .space-tabs { grid-column: 1 / -1; grid-row: 2; justify-content: center; gap: 32px; }
  .intro { padding: 16px 2px; }
  .mine-link { font-size: 15px; }
  .world { height: clamp(285px, calc(100svh - 256px), 700px); }
  .world-controls { bottom: 12px; left: 12px; }
  .world-action { position: static; width: 100%; margin-top: 9px; color: var(--surface); background: var(--green); border-color: var(--green); }
  .world-action:hover { background: #3e4b2e; }
  .footnote { text-align: center; margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; } }
