* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, #ffe6f2 0%, #ece6ff 55%, #e2f4ff 100%);
  background-attachment: fixed;
  color: #514463;
  font-family: "Jua", "Segoe UI", system-ui, "Malgun Gothic", sans-serif;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  color: #ff5fa2;
  letter-spacing: -0.2px;
}

.stage-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  background: #2a2434;
  border: 4px solid #ffffff;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(255, 120, 180, 0.30);
}

#video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#stage {
  display: block;
  max-width: 100%;
  max-height: 62vh;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  margin: 0;
  padding: 5px 12px;
  font-size: 13px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.92);
  color: #ff5fa2;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

button {
  font: inherit;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  background: #ffffff;
  color: #ff5fa2;
  cursor: pointer;
  box-shadow: 0 3px 0 #ffc3dd;
  transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease;
}

button:hover:not(:disabled) {
  background: #fff0f7;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #ffc3dd;
}

button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 2px 0 #ffc3dd;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: 0 3px 0 #e6e6ef;
}

.glasses {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.glasses-shapes { display: flex; flex-wrap: wrap; gap: 6px; }

.glasses-btn.active {
  background: #ff8fc0;
  color: #ffffff;
  box-shadow: 0 3px 0 #e065a2;
}

.style-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.option-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.option-label {
  font-size: 13px;
  font-weight: 600;
  color: #a290b3;
}

.option-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.layout-btn.active,
.bg-btn.active {
  background: #ff8fc0;
  color: #ffffff;
  box-shadow: 0 3px 0 #e065a2;
}

.bg-btn::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.14);
}

.bg-btn[data-bg="white"]::before { background: #ffffff; }
.bg-btn[data-bg="cream"]::before { background: #fff4e2; }
.bg-btn[data-bg="pink"]::before { background: #ffe2ef; }
.bg-btn[data-bg="sky"]::before { background: #e3f1ff; }
.bg-btn[data-bg="dark"]::before { background: #2a2434; }
.bg-btn[data-bg="gradient"]::before { background: linear-gradient(135deg, #ffd9ec, #d9ecff); }

.glasses-size {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #a290b3;
}

.glasses-size input[type="range"] {
  flex: 1;
  accent-color: #ff8fc0;
}

.result {
  display: flex;
  justify-content: center;
}

.result[hidden] {
  display: none;
}

#strip {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(38vh, 360px);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(120, 80, 140, 0.28);
}

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(30, 22, 40, 0.72);
}

.result-modal[hidden] {
  display: none;
}

.result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  max-height: 100%;
}

.result-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

#stripLarge {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(72vh, 640px);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.result-card-btns {
  display: flex;
  gap: 8px;
}

.status {
  margin: 0;
  min-height: 18px;
  font-size: 13px;
  color: #a290b3;
}

.notice {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #a99cbb;
}

@media (max-height: 560px) {
  h1 { font-size: 16px; }
  #stage { max-height: 48vh; }
  #strip { max-height: min(26vh, 200px); }
  .result-title { font-size: 15px; }
  #stripLarge { max-height: min(60vh, 420px); }
  .notice { display: none; }
}
