:root {
  --navy: #315786;
  --navy-dark: #293e59;
  --line: #d7e1ea;
  --surface: #f6f9fb;
  --orange: #e18b27;
  --text: #28394c;
  --muted: #738397;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at 100% 0%, #e8f0f6 0 12%, transparent 12.1%), linear-gradient(135deg, #eef5f9, #faf7f2);
  font-family: Inter, Pretendard, "Noto Sans KR", Arial, sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1840px, calc(100% - 44px));
  min-height: calc(100vh - 44px);
  margin: 22px auto;
  padding: 0 48px 42px;
  overflow: hidden;
  background: rgba(255,255,255,.96);
  border: 1px solid #cbdbe8;
  border-radius: 38px;
  box-shadow: 0 22px 70px rgba(45, 76, 105, .15);
}

.topbar {
  height: 128px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.back-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--navy);
  text-decoration: none;
  font-size: 52px;
  font-weight: 300;
}
.brand-logo { display: block; width: clamp(230px, 24vw, 390px); height: auto; }
.session-chip { justify-self: end; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: #607184; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #43a879; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(430px, .92fr); gap: 28px; }
.preview-panel, .control-panel { min-width: 0; }
.eyebrow { margin: 0 0 7px; color: var(--navy); font-size: 12px; font-weight: 900; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: 25px; }
.design-picker { width: 100%; }
.design-picker label { display: block; margin: 0 0 6px 2px; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .1em; }
.design-picker select { width: 100%; min-height: 44px; padding: 0 42px 0 15px; border: 1px solid #cbd8e2; border-radius: 13px; color: var(--navy); background: #fff; font: inherit; font-weight: 850; cursor: pointer; box-shadow: 0 5px 16px rgba(49,87,134,.09); }
.design-picker select:focus-visible { outline: 3px solid rgba(49,87,134,.18); border-color: var(--navy); }
.edit-availability { display: inline-flex; margin: 5px 0 0 !important; padding: 5px 9px; border-radius: 999px; background: #eef6f2; color: #34765b !important; font-size: 11px !important; font-weight: 800; }
.edit-availability.unavailable { background: #fff5e8; color: #9a6524 !important; }
.control-panel.controls-disabled .control-group,
.control-panel.controls-disabled .fine-control,
.control-panel.controls-disabled .bottom-actions { opacity: .48; }

.eye-stage { position: relative; overflow: hidden; aspect-ratio: 5001 / 3099; background: #d9c4b5; border-radius: 28px; box-shadow: inset 0 0 0 1px rgba(27,52,76,.08); }
.eye-stage canvas { display: block; width: 100%; height: 100%; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: white; background: rgba(38,57,75,.35); font-weight: 700; transition: opacity .2s; }
.loading.hidden { opacity: 0; pointer-events: none; }
.stage-label { position: absolute; left: 24px; top: 22px; display: flex; gap: 8px; }
.stage-label > * { padding: 8px 12px; border-radius: 999px; color: white; background: rgba(37,49,62,.72); backdrop-filter: blur(8px); font-size: 13px; }
.original-toggle { position: absolute; top: 20px; right: 22px; width: 62px; min-height: 62px; display: grid; place-items: center; align-content: center; gap: 2px; padding: 7px; border: 2px solid rgba(255,255,255,.72); border-radius: 17px; color: #fff; background: rgba(34,48,62,.48); box-shadow: 0 5px 16px rgba(0,0,0,.16); backdrop-filter: blur(8px); transition: transform .16s ease, background .16s ease, box-shadow .16s ease; }
.original-toggle img { width: 31px; height: 31px; object-fit: contain; filter: brightness(0) invert(1); }
.original-toggle span { font-size: 10px; font-weight: 900; }
.original-toggle.active { border-color: #fff; background: #df8c25; box-shadow: 0 0 0 4px rgba(255,255,255,.55), 0 8px 20px rgba(94,52,7,.28); transform: scale(1.05); }
.original-toggle:focus-visible { outline: 4px solid rgba(255,255,255,.75); outline-offset: 3px; }
.stage-tools { position: absolute; left: 24px; right: 24px; bottom: 18px; display: grid; grid-template-columns: 82px minmax(80px, 1fr) auto; align-items: end; gap: 18px; }
.camera-button { display: grid; justify-items: center; gap: 3px; padding: 0; border: 0; color: #fff; background: transparent; font-weight: 900; }
.camera-button img { width: 58px; height: 46px; object-fit: contain; }
.camera-button span { font-size: 12px; text-shadow: 0 1px 5px rgba(0,0,0,.25); }
.opacity-slider { display: flex; min-height: 56px; align-items: center; }
.opacity-slider input[type="range"] { height: 7px; background: rgba(255,255,255,.95); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.opacity-slider input[type="range"]::-webkit-slider-thumb { width: 28px; height: 28px; border: 0; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.opacity-presets { display: flex; align-items: end; gap: 5px; }
.design-opacity-button { width: 48px; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; padding: 4px 2px; border: 0; background: transparent; color: rgba(255,255,255,.7); }
.design-opacity-button.active { color: #fff; }
.design-opacity-button:focus-visible { outline: 3px solid rgba(255,255,255,.8); outline-offset: 2px; }
.design-opacity-button > span:last-child { font-size: 12px; font-weight: 900; line-height: 1; }
.design-drop-icon { width: 28px; height: 28px; display: block; border: 2px solid currentColor; border-radius: 60% 0 60% 60%; transform: rotate(-45deg); background-repeat: no-repeat; }
.design-drop-icon.fill-one-third { background-image: linear-gradient(45deg, currentColor 0 33.333%, transparent 33.333% 100%); }
.design-drop-icon.fill-two-thirds { background-image: linear-gradient(45deg, currentColor 0 66.667%, transparent 66.667% 100%); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.preview-actions { display: flex; align-items: center; gap: 18px; padding-top: 14px; }
.preview-actions p { margin: 0; color: var(--muted); font-size: 12px; }

.control-panel { padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; }
.control-header { padding-bottom: 16px; }
.control-header h2 { margin-bottom: 4px; font-size: 20px; }
.control-header > p:last-child { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.editor-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 5px; border-radius: 15px; background: #e7eef4; }
.editor-tabs button { min-height: 45px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px; color: #687a8d; background: transparent; font-weight: 850; }
.editor-tabs button span { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: rgba(103,122,141,.15); font-size: 11px; }
.editor-tabs button.active { color: #fff; background: var(--navy); box-shadow: 0 5px 14px rgba(49,87,134,.2); }
.editor-tabs button.active span { color: var(--navy); background: #fff; }
.tab-panel[hidden] { display: none !important; }
.tab-panel > .control-group:first-child { padding-top: 18px; }
.design-subsection { padding-top: 18px; }
.design-subsection + .design-subsection { margin-top: 18px; padding-top: 20px; border-top: 1px solid var(--line); }
.control-group { padding: 22px 0; border-bottom: 1px solid var(--line); }
.control-group h3 { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; font-size: 15px; }
.control-group h3 span { width: 24px; height: 24px; display: grid; place-items: center; color: white; background: var(--navy); border-radius: 50%; font-size: 12px; }
.group-help { margin: -7px 0 13px; color: var(--muted); font-size: 12px; }
.layer-source-list { display: grid; gap: 8px; }
.layer-source-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 9px 8px 13px; border: 1px solid var(--line); border-radius: 13px; background: #f8fafc; }
.layer-source-row > strong { font-size: 13px; }
.layer-source-row.active { border-color: var(--navy); background: #f1f6fb; box-shadow: inset 3px 0 0 var(--navy); }
.eye-source-row { margin-bottom: 4px; background: #eef4f8; }
.layer-stepper { display: grid; grid-template-columns: 35px minmax(66px, auto) 35px; align-items: center; overflow: hidden; border: 1px solid #d5e0e8; border-radius: 11px; background: #fff; }
.layer-stepper button { width: 35px; height: 34px; padding: 0; border: 0; color: var(--navy); background: #edf3f7; font-size: 23px; line-height: 1; }
.layer-stepper button:hover { background: #dfeaf2; }
.layer-stepper output { padding: 0 8px; color: var(--navy); font-size: 12px; font-weight: 900; text-align: center; }
.segmented { display: grid; grid-template-columns: repeat(3,1fr); padding: 4px; background: #e5ecf2; border-radius: 13px; }
.segmented button { padding: 11px 6px; border: 0; border-radius: 10px; color: #66778a; background: transparent; font-weight: 800; }
.segmented button.active { color: var(--navy); background: white; box-shadow: 0 3px 10px rgba(44,68,92,.12); }
.color-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.color-grid button { display: flex; align-items: center; gap: 8px; padding: 10px; color: #55677a; background: white; border: 1px solid var(--line); border-radius: 12px; font-size: 12px; font-weight: 800; }
.color-grid button.active { color: var(--navy); border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.color-grid i { width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.color-grid .original-swatch { background: conic-gradient(#7d5944, #89959a, #778261, #7d5944); }
.hue-spectrum { padding-top: 16px; }
.hue-spectrum label { display: block; margin-bottom: 8px; color: var(--navy); font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.hue-spectrum input[type="range"] { height: 9px; background: linear-gradient(90deg, #ff3030 0%, #ffd52f 17%, #38d55b 34%, #38d9d9 50%, #3f6fff 67%, #c34dde 84%, #ff3030 100%); }
.hue-spectrum input[type="range"]::-webkit-slider-thumb { width: 21px; height: 21px; border: 4px solid #fff; background: var(--navy); }
.sliders { display: grid; gap: 18px; }
.sliders label > span:first-child { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.sliders small { color: var(--navy); font-weight: 800; }
.range-labels { display: flex; justify-content: space-between; color: #8b99a8; font-size: 11px; }
.range-labels em { font-style: normal; }
input[type="range"] { width: 100%; height: 6px; margin: 0; border-radius: 999px; appearance: none; background: linear-gradient(90deg, #b7c3cc, #4e6f98); accent-color: var(--navy); }
input[type="range"]::-webkit-slider-thumb { width: 20px; height: 20px; appearance: none; border: 4px solid white; border-radius: 50%; background: var(--navy); box-shadow: 0 2px 8px rgba(25,49,72,.28); }
#brightnessRange { background: linear-gradient(90deg, #050505 0%, #4b4b4b 28%, #9b9b9b 58%, #dedede 82%, #fff 100%); box-shadow: inset 0 0 0 1px rgba(35,45,55,.16); }
.fine-control { margin: 18px 0; border: 1px solid var(--line); border-radius: 14px; background: white; }
.fine-control summary { display: flex; justify-content: space-between; padding: 14px 16px; cursor: pointer; color: #526579; font-size: 13px; font-weight: 800; list-style: none; }
.fine-control summary::-webkit-details-marker { display:none; }
.fine-control[open] summary span { transform: rotate(180deg); }
.fine-control > div { padding: 0 16px 16px; }
.fine-control label { display: flex; justify-content: space-between; margin-bottom: 9px; color: #8795a4; font-size: 11px; }
.fine-control input { background: linear-gradient(90deg, #cc765e, #c6b17b, #788ca8); }
.bottom-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 8px; }
.bottom-actions .primary { grid-column: 1 / -1; }
.color-actions { padding-bottom: 8px; }
.complete-action { grid-template-columns: 1fr; padding-top: 14px; border-top: 1px solid var(--line); }
.secondary, .primary { min-height: 44px; padding: 10px 15px; border-radius: 12px; font-weight: 800; }
.secondary { color: var(--navy); background: white; border: 1px solid var(--line); }
.primary { color: white; background: var(--navy); border: 1px solid var(--navy); box-shadow: 0 9px 18px rgba(49,87,134,.2); }
.toast { position: fixed; left: 50%; bottom: 30px; z-index: 10; padding: 14px 20px; color: white; background: #24384e; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.22); opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
  .app-shell { width: min(100% - 20px, 900px); margin: 10px auto; padding: 0 22px 28px; border-radius: 26px; }
  .topbar { height: 96px; }
  .session-chip { display: none; }
  .editor-layout { grid-template-columns: 1fr; }
  .control-panel { padding: 22px; }
}
@media (max-width: 600px) {
  .app-shell { width: 100%; min-height: 100vh; margin: 0; padding: 0 14px 20px; border: 0; border-radius: 0; }
  .topbar { height: 78px; }
  .brand-logo { width: 190px; }
  .back-button { width: 34px; font-size: 40px; }
  h1 { font-size: 19px; }
  .design-picker { width: 100%; }
  .eye-stage { border-radius: 18px; }
  .stage-tools { left: 10px; right: 10px; bottom: 8px; grid-template-columns: 50px minmax(50px, 1fr) auto; gap: 8px; }
  .camera-button img { width: 44px; height: 35px; }
  .camera-button span { font-size: 10px; }
  .opacity-slider { min-height: 45px; }
  .design-opacity-button { width: 39px; min-height: 50px; }
  .design-drop-icon { width: 22px; height: 22px; }
  .design-opacity-button > span:last-child { font-size: 10px; }
  .stage-label { left: 10px; top: 10px; }
  .original-toggle { top: 9px; right: 10px; width: 50px; min-height: 50px; padding: 5px; border-radius: 13px; }
  .original-toggle img { width: 25px; height: 25px; }
  .original-toggle span { font-size: 9px; }
  .preview-actions { align-items: start; flex-direction: column; gap: 8px; }
  .control-panel { padding: 18px; border-radius: 20px; }
}
