/* 캐릭터 상세 화면 전용: 기존 메인홈 스타일에는 영향을 주지 않습니다. */

html.character-app-page { overflow: hidden; }

.character-app-page body { overflow: hidden; background: #fff; }

.character-app {

  --app-border: #d1d1d1;

  --app-chrome: #f1f1f1;

  --app-panel: #fafafa;

  --bar-surface: linear-gradient(to bottom, #fafafa 0%, #efefef 50%, #dcdcdc 100%);

  --title-surface: linear-gradient(to bottom, #ffffff 0%, #f7f7f7 50%, #e5e5e5 100%);

  --panel-surface: linear-gradient(to bottom, #fdfdfd 0%, #f7f7f7 55%, #ededed 100%);

  --selection-surface: linear-gradient(to bottom, #eeeeee 0%, #e2e2e2 50%, #cdcdcd 100%);

  --button-surface: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 45%, #c7c7c7 100%);

  --button-hover: linear-gradient(to bottom, #ffffff 0%, #e8e8e8 45%, #b8b8b8 100%);

  --button-pressed: linear-gradient(to bottom, #d2d2d2 0%, #e6e6e6 55%, #f5f5f5 100%);

  display: grid;

  grid-template-rows: 30px 36px minmax(0, 1fr) 28px;

  width: 100%;

  height: 100vh;

  height: 100dvh;

  color: var(--ink);

  font-size: 12px;

  line-height: 1.4;

}

.character-app button, .character-app summary { font: inherit; color: inherit; }

.character-app button { cursor: pointer; }

.character-app button:focus-visible, .character-app summary:focus-visible {

  outline: 2px solid #4d4d4d;

  outline-offset: -3px;

}

.app-titlebar { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--app-border); background: var(--title-surface); }

.app-titlebar img { display: block; object-fit: contain; image-rendering: auto; }

.app-titlebar h1 { display: flex; align-items: baseline; gap: 12px; margin: 0; font-size: 12px; font-weight: 400; }

.app-titlebar time { color: #666; }

.app-brand { margin-left: auto; color: #777; font-size: 10px; }

.app-menubar { display: flex; align-items: stretch; gap: 22px; padding-inline: 6px; border-bottom: 1px solid var(--app-border); background: var(--bar-surface); min-width: 0; }

.app-menus { display: flex; flex: 0 0 auto; align-items: stretch; gap: 1px; }

.app-menu { position: relative; }

.app-menu summary { display: flex; align-items: center; height: 100%; padding: 0 10px; list-style: none; cursor: pointer; user-select: none; }

.app-menu summary::-webkit-details-marker { display: none; }

.app-menu[open] summary, .app-menu summary:hover { background: #e2e2e2; }

.app-dropdown { position: absolute; top: calc(100% + 1px); left: 0; z-index: 20; min-width: 190px; padding: 5px; border: 1px solid #c5c5c5; background: #fff; box-shadow: 0 3px 10px #00000012; }

.app-dropdown a, .app-dropdown button { display: block; width: 100%; border: 0; padding: 9px 10px; background: transparent; text-align: left; white-space: nowrap; }

.app-dropdown a:hover, .app-dropdown button:hover { background: #eeeeee; text-decoration: none; }

.help-dropdown { width: 290px; padding: 16px; }

.help-dropdown strong { display: block; margin-bottom: 12px; font-weight: 400; }

.help-dropdown p { margin-top: 8px; font-size: 12px; line-height: 1.7; }

.workspace-tabs { display: flex; align-items: stretch; min-width: 0; gap: 3px; padding-top: 5px; overflow-x: auto; scrollbar-width: none; }

.workspace-tabs::-webkit-scrollbar { display: none; }

.workspace-tab { flex: 0 0 auto; border: 1px solid transparent; border-bottom: 0; padding: 0 14px; background: transparent; white-space: nowrap; }

.workspace-tab.is-active { border-color: var(--app-border); border-radius: 4px 4px 0 0; background: #fff; }

.workspace-tab:disabled { opacity: 1; color: #777; cursor: default; }

.app-editors { display: grid; grid-template-columns: minmax(0, 1fr) 248px; min-height: 0; }

.viewport-editor { display: grid; grid-template-rows: 32px minmax(0, 1fr); min-width: 0; min-height: 0; }

.editor-header { display: flex; align-items: center; gap: 14px; min-height: 32px; padding: 0 12px; border-bottom: 1px solid var(--app-border); background: var(--bar-surface); white-space: nowrap; }

.editor-kind { display: inline-flex; align-items: center; gap: 7px; }

.cube-icon, .object-symbol { font: 20px/1 sans-serif; }

.editor-mode { padding: 2px 7px; border: 1px solid #d4d4d4; border-radius: 3px; background: #fbfbfb; font-size: 11px; }

#reset-view { margin-left: auto; border: 1px solid #d4d4d4; border-radius: 3px; padding: 2px 7px; background: transparent; font-size: 11px; }

#reset-view:hover:not(:disabled) { background: #e4e4e4; }

#reset-view:disabled { cursor: default; color: #999; }

.model-viewport { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #f4f4f4; }

.model-viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.viewport-label { position: absolute; top: 18px; left: 18px; z-index: 1; display: grid; gap: 5px; font-size: 11px; color: #777; pointer-events: none; }

#model-status { position: absolute; inset: 0; z-index: 2; display: grid; align-content: center; padding: 24px; text-align: center; pointer-events: none; }

#model-status[hidden] { display: none; }

.inspector { display: grid; grid-template-rows: minmax(150px, 35%) minmax(0, 1fr); min-height: 0; border-left: 1px solid var(--app-border); background: var(--app-panel); }

.outliner-editor { display: grid; grid-template-rows: 32px minmax(0, 1fr); min-height: 0; border-bottom: 1px solid var(--app-border); background: var(--panel-surface); }

.panel-mark { margin-left: auto; color: #888; }

.scene-tree { padding: 9px 0; overflow-y: auto; }

.tree-collection { display: flex; align-items: center; gap: 8px; padding: 5px 14px; }

.tree-object { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 5px 14px 5px 34px; background: var(--selection-surface); }

.character-parts > summary { padding-left: 20px; list-style: none; cursor: pointer; }

.character-parts > summary::-webkit-details-marker { display: none; }

.collapsible-group > summary { list-style: none; cursor: pointer; }

.collapsible-group > summary::-webkit-details-marker { display: none; }

.disclosure-icon { display: block; width: 12px; height: 12px; flex: 0 0 12px; align-self: center; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.collapsible-group[open] > summary .disclosure-icon { transform: rotate(90deg); }

.character-part-list { margin: 0; padding: 3px 0; list-style: none; }

.character-part-list li { display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 50px; }

.character-part-list .object-symbol { color: #777; font-size: 16px; }

.properties-editor { min-height: 0; overflow-y: auto; background: var(--panel-surface); }

.properties-body { padding: 16px 12px; }

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

.character-properties { margin: 0; }

.character-properties > div { display: grid; grid-template-columns: 55px minmax(0, 1fr); align-items: baseline; gap: 10px; margin: 12px 0; }

.character-properties dt { color: #777; text-align: right; font-size: 11px; }

.character-properties dd { margin: 0; padding: 5px 8px; border: 1px solid #dedede; border-radius: 3px; background: #fff; overflow-wrap: anywhere; }

/* 아래쪽이 진하고 위쪽이 밝은 연속 그라데이션 버튼 */

.app-menu > summary,

.workspace-tab,

#reset-view,

.app-dropdown > button,

.app-dropdown > a {

  background: var(--button-surface);

}

.app-menu > summary:hover,

.app-menu[open] > summary,

.workspace-tab:not(:disabled):hover,

#reset-view:hover:not(:disabled),

.app-dropdown > button:hover,

.app-dropdown > a:hover {

  background: var(--button-hover);

}

.workspace-tab.is-active {

  background: linear-gradient(to bottom, #ffffff 0%, #f6f6f6 45%, #d8d8d8 100%);

}

.app-menu > summary:active,

.workspace-tab:not(:disabled):active,

#reset-view:not(:disabled):active,

.app-dropdown > button:active,

.app-dropdown > a:active {

  background: var(--button-pressed);

}

.app-statusbar { display: flex; align-items: center; gap: 12px; padding: 0 12px; border-top: 1px solid var(--app-border); background: var(--bar-surface); }

.model-help { margin: 0; font-size: 10px; color: #626262; }

.status-brand { margin-left: auto; font-size: 10px; color: #888; }

@media (max-width: 900px) {

  .app-editors { grid-template-columns: minmax(0, 1fr) 200px; }

  .workspace-tab { padding-inline: 10px; }

  .app-menubar { gap: 10px; }

}

@media (max-width: 680px) {

  .character-app { grid-template-rows: 30px 66px minmax(0, 1fr) 28px; }

  .app-menubar { flex-wrap: wrap; gap: 0; padding-inline: 4px; }

  .app-menus { height: 30px; width: 100%; }

  .workspace-tabs { width: 100%; height: 35px; padding-top: 3px; }

  .workspace-tab { padding-inline: 12px; }

  .app-editors { grid-template-columns: minmax(0, 1fr); }

  .inspector { display: none; }

  .app-brand, .status-brand { display: none; }

  .editor-header { gap: 8px; padding-inline: 8px; }

  .editor-kind, .editor-mode, #reset-view { font-size: 10px; }

  .viewport-label { top: 12px; left: 12px; }

  .help-dropdown { left: -90px; width: min(290px, calc(100vw - 24px)); }

}


/* 세로 탭은 항상 표시하고, 글 패널만 모델 화면 위에서 펼칩니다. */
.viewport-surface { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.viewport-surface .model-viewport { width: 100%; height: 100%; }
.story-sidebar { position: absolute; inset: 0 0 0 auto; z-index: 3; width: 28px; }
.story-rail { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding-top: 10px; background: transparent; }
.story-rail button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 62px;
  padding: 10px 5px;
  border: 1px solid #cfcfcf;
  border-right: 0;
  border-radius: 4px 0 0 4px;
  background: var(--button-surface);
  writing-mode: vertical-rl;
  letter-spacing: 2px;
}
.story-rail button:hover { background: var(--button-hover); }
.story-rail button[aria-expanded="true"] { background: #fff; border-color: #a9a9a9; }
.story-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 28px;
  display: grid;
  grid-template-rows: 32px minmax(0, 1fr);
  width: 280px;
  max-width: calc(100vw - 56px);
  border-left: 1px solid var(--app-border);
  border-right: 1px solid var(--app-border);
  border-bottom: 1px solid var(--app-border);
  background: var(--panel-surface);
}
.story-panel[hidden] { display: none; }
.story-panel-header { justify-content: space-between; }
.story-panel-header h2 { margin: 0; font-size: 12px; font-weight: 400; }
#story-panel-close { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 4px; border: 1px solid #d3d3d3; border-radius: 3px; background: var(--button-surface); }
#story-panel-close:hover { background: var(--button-hover); }
#story-panel-close svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.story-panel-content { overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px; }
.story-panel-content p { margin: 0 0 16px; color: var(--ink); font-size: 13px; line-height: 1.9; white-space: pre-line; }
.story-panel-content p:last-child { margin-bottom: 0; }
.story-panel-content .story-empty { color: #777; }
html[lang="en"] .story-rail button { letter-spacing: 0; }
@media (max-width: 680px) {
  .story-panel { width: min(260px, calc(100vw - 56px)); }
}
