/* LED 빛 공방: 세 화면이 같이 쓰는 모양 */
html { font-size: calc(8px + 1.33vh); }
* { box-sizing: border-box; word-break: keep-all; }
body {
  margin: 0; height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: none;
  background: #090B0E; color: #F2F4F7;
  font-family: Pretendard, 'Malgun Gothic', sans-serif;
  display: flex; flex-direction: column; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; }
.top {
  display: flex; align-items: center; gap: .8rem; padding: .55rem 1rem; min-height: 3.4rem;
  border-bottom: 1px solid rgba(255,255,255,.08); flex: none;
}
.top h1 { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.top .sub { color: #9AA3B0; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .sp { flex: 1; }
a.back, a.next, .pill {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: 0 1rem;
  border-radius: 20px; text-decoration: none; font-weight: 700; font-size: .95rem; white-space: nowrap;
}
a.back { background: rgba(255,255,255,.08); color: #F2F4F7; }
a.next { background: #F2F4F7; color: #0B0D10; }
.main { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; position: relative; min-width: 0; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.panel {
  width: 23rem; flex: none; border-left: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: .7rem; padding: .8rem; overflow-y: auto; min-height: 0;
  background: #0D1014;
}
.panel h2 { margin: 0; font-size: .85rem; font-weight: 700; color: #9AA3B0; letter-spacing: .02em; }
.group { display: flex; flex-direction: column; gap: .45rem; }
.row { display: flex; gap: .4rem; flex-wrap: wrap; }
.btn {
  min-height: 40px; padding: 0 .85rem; border-radius: 12px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05); color: #E6E9EE; font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; cursor: pointer;
}
.btn:active { background: rgba(255,255,255,.16); }
.btn.on { background: #F2F4F7; color: #0B0D10; border-color: #F2F4F7; }
.btn.warn { color: #FFB4A8; }
.btn.go { background: #FFC94A; color: #1A1400; border-color: #FFC94A; }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.tools .btn { flex-direction: column; gap: .15rem; padding: .35rem .2rem; min-height: 3.6rem; font-size: .78rem; }
.tools .btn svg { width: 1.5em; height: 1.5em; }
.swatches { display: flex; gap: .4rem; flex-wrap: wrap; }
.sw {
  width: 2.5rem; height: 2.5rem; min-width: 40px; min-height: 40px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer; padding: 0; position: relative;
}
.sw.on { border-color: #F2F4F7; box-shadow: 0 0 0 2px #0D1014 inset; }
.msg {
  border-radius: 12px; padding: .65rem .8rem; font-size: .95rem; line-height: 1.45;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
}
.msg b { color: #FFC94A; }
.msg.good { background: rgba(70,200,120,.12); border-color: rgba(70,200,120,.35); }
.msg.bad { background: rgba(255,110,90,.12); border-color: rgba(255,110,90,.35); }
.toast {
  position: absolute; left: 50%; top: 1rem; transform: translateX(-50%);
  background: rgba(20,24,30,.92); border: 1px solid rgba(255,255,255,.15); border-radius: 14px;
  padding: .6rem 1.1rem; font-weight: 700; font-size: 1rem; pointer-events: none;
  opacity: 0; transition: opacity .25s; white-space: nowrap; z-index: 5;
}
.toast.show { opacity: 1; }
.seg { display: flex; background: rgba(255,255,255,.05); border-radius: 12px; padding: 3px; gap: 3px; }
.seg .btn { flex: 1; border: none; background: transparent; min-height: 40px; padding: 0 .4rem; }
.panel > .bottom, .panel > .row.bottom { position: sticky; bottom: -.8rem; margin: auto -.8rem -.8rem; padding: .6rem .8rem .8rem; background: #0D1014; border-top: 1px solid rgba(255,255,255,.06); z-index: 2; }
.seg .btn.on { background: #F2F4F7; color: #0B0D10; }
input[type=range] { width: 100%; accent-color: #FFC94A; height: 32px; }
input[type=text] {
  min-height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); background: #151920;
  color: #F2F4F7; font: inherit; padding: 0 .7rem; flex: 1; min-width: 0; -webkit-user-select: text; user-select: text;
}
.hint { color: #8F98A6; font-size: .82rem; line-height: 1.45; }
.dialog {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 20;
}
.dialog.show { display: flex; }
.dialog .box {
  background: #14181E; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 1.3rem 1.4rem;
  width: min(92vw, 34rem); max-height: 90vh; overflow: auto;
}
.dialog h3 { margin: 0 0 .7rem; font-size: 1.3rem; }
.dialog ol { margin: 0 0 1rem; padding-left: 1.3rem; line-height: 1.7; font-size: 1rem; }

@media (max-width: 820px) {
  body { overflow: auto; height: auto; min-height: 100dvh; }
  .main { flex-direction: column; }
  .stage { height: 58vh; flex: none; position: sticky; top: 0; z-index: 2; background: #090B0E; }
  .panel { width: auto; border-left: none; border-top: 1px solid rgba(255,255,255,.08); overflow: visible; }
  .top .sub { display: none; }
  .top { gap: .5rem; padding: .5rem .6rem; }
  .top h1 { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  a.back, a.next { padding: 0 .7rem; font-size: .85rem; }
}
@media (orientation: landscape) and (max-height: 520px) {
  html { font-size: 12px; }
  .panel { width: 19rem; }
}
