/* 노치찜 리모콘. VTT와 같은 어두운 바탕·금색 가는 선·SUITE를 쓴다.
   움직임은 색·투명도 전환만 두고, 반짝임·흔들림·반복 효과는 쓰지 않는다. */

@font-face { font-family: 'SUITE'; src: url('/fonts/SUITE-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'SUITE'; src: url('/fonts/SUITE-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'SUITE'; src: url('/fonts/SUITE-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #050404;
  --bg-lift: #141117;
  --panel: rgba(13, 12, 10, 0.9);
  --panel-inner: rgba(255, 255, 255, 0.025);
  --line: rgba(212, 181, 104, 0.24);
  --line-soft: rgba(212, 181, 104, 0.1);
  --gold: #e4c570;
  --gold-dim: #b89a4c;
  --ivory: #f0dfb8;
  --muted: #9c927f;
  --faint: #6b6456;
  --rust: #c0583a;
  --rust-deep: #8e3a25;
  --sage: #9fbf8f;
  --amber: #d9a54a;
  --radius: 4px;
  --font: 'SUITE', 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  font-family: var(--font);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ivory);
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
  /* VTT 첫 화면의 태양빛 한 점과 가장자리 어둠만 남긴다(움직이지 않음). */
  background:
    radial-gradient(ellipse 80% 45% at 50% 18%, rgba(255, 220, 160, 0.09), rgba(212, 181, 104, 0.035) 45%, transparent 75%),
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.7) 100%),
    linear-gradient(180deg, transparent 55%, rgba(20, 16, 12, 0.6)),
    var(--bg);
  background-attachment: fixed;
}

.shell {
  width: min(30rem, 100%);
  margin: 0 auto;
  padding:
    max(1.25rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

[hidden] { display: none !important; }

/* ---- 머리 ---- */

.top {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.emblem {
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
}

.brand { flex: 1; min-width: 0; }

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.32em;
}

h1 {
  margin: 0.1rem 0 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---- 패널: 금색 가는 테두리 안에 한 겹 더 얇은 선 ---- */

.panel {
  position: relative;
  padding: 1.35rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  pointer-events: none;
}

#control-view > * + * { margin-top: 1rem; }

.card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.card-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.card-title { white-space: nowrap; }

.card-title span {
  color: var(--muted);
  letter-spacing: 0.08em;
  font-weight: 400;
}

/* ---- 로그인: VTT 첫 화면처럼 위아래 검은 띠, 큰 제목, 밑줄 입력칸. 그림 없이 검정과 금색 선만 쓴다. ---- */

.login-view {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: calc(100dvh - 4rem);
  padding: 4.5rem 0.5rem 4rem;
  text-align: center;
}

.letterbox {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.6rem;
  padding: 0 max(1rem, env(safe-area-inset-left));
  background: #000;
  color: rgba(212, 181, 104, 0.5);
  font-size: 0.56rem;
  letter-spacing: 0.3em;
  white-space: nowrap;
  overflow: hidden;
}

.letterbox.top {
  top: 0;
  padding-top: env(safe-area-inset-top);
  height: calc(2.6rem + env(safe-area-inset-top));
  border-bottom: 1px solid rgba(212, 181, 104, 0.12);
}

.letterbox.bottom {
  bottom: 0;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(2.6rem + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(212, 181, 104, 0.12);
}

.login-emblem {
  width: 6rem;
  height: 6rem;
  margin-bottom: 1.1rem;
  opacity: 0.92;
  filter: drop-shadow(0 0 18px rgba(212, 181, 104, 0.2));
}

.login-overline {
  margin: 0 0 1rem;
  color: rgba(212, 181, 104, 0.6);
  font-size: 0.62rem;
  letter-spacing: 0.45em;
}

.login-title {
  margin: 0;
  color: var(--ivory);
  font-size: clamp(2.4rem, 12vw, 3.6rem);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1;
  text-shadow: 0 2px 36px rgba(255, 220, 160, 0.3), 0 0 70px rgba(212, 181, 104, 0.16);
}

.login-sub {
  margin: 0.9rem 0 0;
  color: rgba(240, 223, 184, 0.55);
  font-size: 0.8rem;
  letter-spacing: 0.5em;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 1.9rem auto 1.6rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  width: 3.6rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 181, 104, 0.5));
}

.login-divider::after { background: linear-gradient(90deg, rgba(212, 181, 104, 0.5), transparent); }

.login-divider span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(212, 181, 104, 0.8);
  box-shadow: 0 0 8px rgba(212, 181, 104, 0.6);
}

.login {
  display: grid;
  gap: 0.9rem;
  width: 100%;
  text-align: left;
}

.login-view .login {
  width: min(22rem, 100%);
  text-align: center;
}

label {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

.login-view label {
  margin-bottom: -0.6rem;
  color: rgba(212, 181, 104, 0.6);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
}

input {
  width: 100%;
  min-height: 3.1rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ivory);
  font: inherit;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  transition: border-color 200ms ease;
}

input:focus { border-color: var(--gold-dim); }

/* VTT 로그인 입력칸: 테두리 없이 밑줄 하나 */
.line-input {
  min-height: 2.9rem;
  padding: 0 0.25rem;
  border: 0;
  border-bottom: 1px solid rgba(240, 223, 184, 0.25);
  border-radius: 0;
  background: transparent;
  text-align: center;
  letter-spacing: 0.12em;
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

.line-input:focus {
  outline: none;
  border-bottom-color: rgba(240, 223, 184, 0.8);
  box-shadow: 0 4px 18px -8px rgba(255, 220, 160, 0.3);
}

.line-input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #050404 inset;
  -webkit-text-fill-color: var(--ivory);
}

.login-view .button.primary {
  justify-self: center;
  width: 10rem;
  min-height: 3rem;
  margin-top: 0.6rem;
  border: 1px solid rgba(240, 223, 184, 0.3);
  border-radius: 0;
  background: transparent;
  color: var(--ivory);
  font-weight: 500;
  letter-spacing: 0.4em;
  transition: background-color 300ms ease, border-color 300ms ease;
}

.login-view .button.primary:not(:disabled):active,
.login-view .button.primary:hover {
  border-color: var(--ivory);
  background: rgba(240, 223, 184, 0.08);
}

.login-view #join-submit { width: auto; padding: 0 1.4rem; letter-spacing: 0.2em; }

.login-view .creator { margin-top: 2.2rem; }

/* ---- 서버 상태 ---- */


.state-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  flex: none;
  transform: rotate(45deg);
  border: 1px solid var(--faint);
  background: transparent;
  transition: background-color 400ms ease, border-color 400ms ease, box-shadow 400ms ease;
}

.status[data-state="RUNNING"] .dot {
  background: var(--sage);
  border-color: var(--sage);
  box-shadow: 0 0 10px rgba(159, 191, 143, 0.45);
}
.status[data-state="STARTING"] .dot,
.status[data-state="STOPPING"] .dot { background: var(--amber); border-color: var(--amber); }
.status[data-state="DEGRADED"] .dot,
.status[data-state="UNREACHABLE"] .dot { background: var(--rust); border-color: var(--rust); }

h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status[data-state="RUNNING"] h2 { color: var(--ivory); }
.status[data-state="STOPPED"] h2 { color: var(--muted); }

.facts {
  display: grid;
  margin: 1rem 0 0;
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line-soft);
}

.facts dt { color: var(--muted); white-space: nowrap; font-size: 0.92rem; }
.facts dd { margin: 0; text-align: right; font-size: 0.95rem; font-variant-numeric: tabular-nums; }

.vtt-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
  background: rgba(228, 197, 112, 0.05);
}

.vtt-link::after { content: '↗'; }

/* ---- 버튼 ---- */

.actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.1rem;
}

.actions.three { grid-template-columns: repeat(3, 1fr); }
.actions.two { grid-template-columns: repeat(2, 1fr); }
.actions.one { grid-template-columns: 1fr; }

.button {
  min-height: 3.2rem;
  padding: 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ivory);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, opacity 200ms ease;
}

.button:not(:disabled):active { background: rgba(228, 197, 112, 0.1); }

.button.primary {
  border-color: var(--gold);
  background: var(--gold);
  color: #1a1408;
}

.button.primary:not(:disabled):active { background: var(--gold-dim); }

.button.danger {
  border-color: var(--rust);
  background: var(--rust-deep);
  color: var(--ivory);
}

.button:disabled {
  opacity: 0.32;
  cursor: default;
}

.text-button {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  padding: 0.5rem 0;
  cursor: pointer;
}

.button:focus-visible,
.text-button:focus-visible,
.vtt-link:focus-visible,
.footer-link a:focus-visible,
input:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 3px;
}

/* ---- 확인 패널: 붉은 선으로 구분 ---- */

.confirm {
  border-color: rgba(192, 88, 58, 0.55);
}

.confirm::before { border-color: rgba(192, 88, 58, 0.2); }

.confirm p { margin: 0 0 1rem; line-height: 1.65; }

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

/* ---- 진행·기록 ---- */

.job-line {
  margin: 0.9rem 0 0;
  padding: 0.6rem 0.8rem;
  border-left: 2px solid var(--gold-dim);
  background: rgba(228, 197, 112, 0.05);
  color: var(--ivory);
  font-size: 0.9rem;
}

.job-line[data-state="SUCCEEDED"] { border-left-color: var(--sage); }
.job-line[data-state="FAILED"] { border-left-color: var(--rust); color: #e9b3a3; }

.log {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.log summary { cursor: pointer; }

.log pre {
  max-height: 14rem;
  overflow: auto;
  margin: 0.5rem 0 0;
  padding: 0.7rem;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 결과 안내는 머리 바로 아래 한 줄. 비어 있으면 자리를 차지하지 않는다. */
.notice {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius);
  background: rgba(228, 197, 112, 0.06);
  color: var(--ivory);
  font-size: 0.92rem;
}

.notice:empty { display: none; }

.footer-link {
  margin: 1.4rem 0 0;
  text-align: center;
  font-size: 0.85rem;
}

.footer-link a {
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}

.footer {
  margin-top: 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line-soft);
}

.motto {
  margin: 0.9rem 0 0;
  color: var(--faint);
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-align: center;
}

/* 제작자 서명. VTT 로그인 화면의 서명과 같은 구성이다. */
.creator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  user-select: none;
}

.creator-avatar {
  display: block;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid rgba(243, 220, 164, 0.62);
  border-radius: 7px;
  object-fit: cover;
  background: rgba(18, 16, 12, 0.34);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.creator-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
  white-space: nowrap;
}

.creator-kicker {
  color: rgba(245, 229, 186, 0.8);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.creator-name {
  color: #fff0bd;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}


@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- 허브 카드의 PC 목록 ---- */

.pc-list {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.pc-row {
  padding: 0.85rem 0.9rem 0.9rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

.pc-row .actions { margin-top: 0.75rem; }
.pc-row .button { min-height: 2.8rem; font-size: 0.92rem; }
.pc-row .job-line { margin-top: 0.6rem; }

.pc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.pc-head strong { font-size: 1rem; }

.pc-state {
  color: var(--faint);
  font-size: 0.85rem;
  white-space: nowrap;
}

.pc-state.is-online { color: var(--sage); }

.pc-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

/* PC 서버 카드: 카드 제목 바로 아래에서 시작하고, 켤 수 없는 이유는 작은 한 줄로만 적는다. */
.home-list { margin-top: 0; }
.home-list .pc-head strong { font-size: 1.05rem; }

.pc-hint {
  margin: 0.6rem 0 0;
  color: var(--faint);
  font-size: 0.82rem;
  line-height: 1.5;
}

.confirm p { white-space: pre-line; }

.footer-link {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
}

.rename {
  display: grid;
  gap: 0.75rem;
}

/* ---- 계정: 머리의 내 이름, 초대 가입, 비밀번호 바꾸기 ---- */

.who {
  display: grid;
  justify-items: end;
  gap: 0;
  flex: none;
}

.who-name {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who .text-button { padding: 0.2rem 0 0; }

.login .text-button { justify-self: center; }

#join-code { text-transform: uppercase; letter-spacing: 0.2em; }
#join-name { letter-spacing: 0.02em; }

.account-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}

.account-form .actions { margin-top: 0.2rem; }

/* 휴대폰 앱 새 버전 안내: 알림 아래 한 줄, 누르면 앱이 받아서 설치 창을 연다. */
.app-update {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--sage);
  border-radius: var(--radius);
  background: rgba(159, 191, 143, 0.06);
  font-size: 0.9rem;
}

.app-update a {
  flex: none;
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

/* 관리자에게만 보이는 권한 바꾸기 줄 */
.role-list {
  display: grid;
  gap: 0.2rem;
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
}

.role-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.role-list .text-button { color: var(--gold); }

/* ---- 아래로 내린 허브·코드 카드: 평소 한 줄로 접어 둔다 ---- */

.fold { padding-bottom: 1.25rem; }
.fold:not([open]) { padding-bottom: 1.1rem; }

.fold-title {
  margin: 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.fold-title::-webkit-details-marker { display: none; }

.fold[open] > .fold-title { margin-bottom: 0.9rem; }

.fold-meta {
  order: 3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.fold-title::after { order: 2; }

.fold-title::before {
  content: '';
  order: 4;
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.2rem;
  border-right: 1px solid var(--gold-dim);
  border-bottom: 1px solid var(--gold-dim);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 200ms ease;
}

.fold[open] > .fold-title::before { transform: rotate(-135deg) translate(-2px, -2px); }

.fold-title:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 4px;
}

.app-update small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

/* ---- 허브 카드: 작은 소제목으로 허브 / PC / VPS를 나누고, 대조 결과는 색 하나로만 구분한다 ---- */

.sub-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 1.4rem 0 0;
  color: var(--gold-dim);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.24em;
}

.sub-title span {
  color: var(--faint);
  letter-spacing: 0.06em;
  font-weight: 400;
}

.sub-title + .pc-list { margin-top: 0.6rem; }
.facts.compact { margin-top: 0.4rem; }

.facts dd small {
  display: block;
  margin-top: 0.15rem;
  color: var(--faint);
  font-size: 0.78rem;
}

.sync {
  display: grid;
  gap: 0.3rem;
  margin: 0.7rem 0 0;
}

.sync div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.sync dt { flex: none; color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.sync dd { margin: 0; text-align: right; font-size: 0.9rem; }

.sync dd small {
  display: block;
  margin-top: 0.1rem;
  color: var(--faint);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.sync-when {
  margin: 0.45rem 0 0;
  color: var(--faint);
  font-size: 0.78rem;
}

[data-tone="same"] { color: var(--sage); }
[data-tone="differ"] { color: var(--amber); }
[data-tone="conflict"] { color: var(--rust); }
[data-tone="quiet"] { color: var(--muted); }
.fold-meta[data-tone=""] { color: var(--muted); }

/* 빈 서버 자동 닫기 안내: 서버 카드 안의 작은 한 줄 */
.idle-line {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* VPS 상태판: 숫자 아래 얇은 막대 하나. 75% 넘으면 노랑, 90% 넘으면 빨강. */
.meters dd { min-width: 0; }

.meter {
  display: block;
  width: 9rem;
  max-width: 100%;
  height: 3px;
  margin: 0.35rem 0 0 auto;
  border-radius: 2px;
  background: var(--line-soft);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--sage);
  transition: width 400ms ease;
}

.meter i[data-tone="differ"] { background: var(--amber); }
.meter i[data-tone="conflict"] { background: var(--rust); }
