:root{
  --text:#f3f7ff;
  --muted:rgba(243,247,255,.72);
  --stroke: rgba(255,255,255,.14);
  --shadow: 0 22px 80px rgba(0,0,0,.55);
  --brand:#6C5CE7;
  --brand2:#00D2FF;
  --accent:#00F5A0;
  --danger:#ff4d4f;
  --radius:26px;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans KR, Arial, sans-serif;
  color:var(--text);
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;

  /* Background image + cinematic overlays */
  background:
    radial-gradient(1000px 520px at 20% 10%, rgba(108,92,231,.35), transparent 60%),
    radial-gradient(920px 520px at 85% 0%, rgba(0,210,255,.25), transparent 55%),
    radial-gradient(900px 680px at 55% 100%, rgba(0,245,160,.14), transparent 55%),
    var(--page-bg-image, none);
  background-size: cover, cover, cover, cover;
  background-position: center, center, center, center;
  background-repeat:no-repeat;
}

.grain{
  position:fixed; inset:0; z-index:0; pointer-events:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode:overlay;
  opacity:.25;
}

.shade{
  position:fixed; inset:0; z-index:0; pointer-events:none;
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.35));
}

.wrap{width:min(440px, 100%); position:relative; z-index:1;}
.safe{padding-bottom: env(safe-area-inset-bottom);}

/* Glass card */
.card{
  border-radius:var(--radius);
  overflow:hidden;
  border:1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(12,16,34,.66), rgba(12,16,34,.40));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  position:relative;
}
.card:before{
  content:"";
  position:absolute; inset:-60px -60px auto auto;
  width:280px; height:280px;
  background: radial-gradient(circle at 30% 30%, rgba(0,245,160,.20), transparent 60%);
  filter: blur(2px);
  pointer-events:none;
}

.hero{padding:18px 18px 8px; position:relative;}
.topRow{display:flex; align-items:center; justify-content:space-between; gap:10px;}

.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  font-size:12px;
  color:rgba(243,247,255,.78);
}
.dot{
  width:9px;height:9px;border-radius:99px;
  background:var(--accent);
  box-shadow:0 0 18px rgba(0,245,160,.55);
}
.tag{
  font-size:12px;
  padding:8px 10px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  color:rgba(243,247,255,.72);
}

h1{
  margin:12px 0 6px;
  font-size:26px;
  letter-spacing:-.4px;
  line-height:1.12;
}
.sub{margin:0; color:var(--muted); font-size:13px; line-height:1.6;}

.content{padding:10px 18px 18px;}
label{font-size:12px; color:rgba(243,247,255,.75)}
.field{display:flex; flex-direction:column; gap:8px; margin-top:12px;}

.inputWrap{display:flex; gap:12px; align-items:stretch;}
.inputBox{
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 12px;
  height:52px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}
.icon{
  width:34px;height:34px;border-radius:14px;
  display:grid;place-items:center;
  background: linear-gradient(180deg, rgba(108,92,231,.9), rgba(0,210,255,.65));
  box-shadow: 0 12px 30px rgba(108,92,231,.25);
  font-weight:900;
}
input{
  width:100%;
  height:50px;
  border:none;
  outline:none;
  background:transparent;
  color:var(--text);
  font-size:16px;
  padding:0 2px;
}
input::placeholder{color:rgba(243,247,255,.45)}

.matchBtn{
  width:132px;
  height:52px;
  border:none;
  border-radius:18px;
  color:#061018;
  font-weight:1000;
  cursor:pointer;
  letter-spacing:-.2px;
  background: linear-gradient(135deg, rgba(0,245,160,1), rgba(0,210,255,1));
  box-shadow: 0 16px 36px rgba(0,210,255,.22), 0 10px 28px rgba(0,245,160,.16);
  position:relative;
  overflow:hidden;
}
.matchBtn:before{
  content:"";
  position:absolute; inset:-40px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), transparent 55%);
  transform: translateX(-40%);
  opacity:.35;
}
.matchBtn:active{transform:translateY(1px)}
.matchBtn[disabled]{opacity:.55; cursor:not-allowed; box-shadow:none}

.err{display:none; margin-top:6px; color:#ffd0d0; font-size:12px; line-height:1.45;}
.err.show{display:block}

.callout{
  margin-top:14px;
  padding:12px 12px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.12));
  color:rgba(243,247,255,.72);
  font-size:12px;
  line-height:1.6;
}
.callout b{color:rgba(243,247,255,.9)}

/* Overlay */
.overlay{
  position:fixed; inset:0;
  background: rgba(0,0,0,.68);
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:50;
}
.overlay.show{display:flex}

.matchBox{
  width:min(440px, 100%);
  border-radius:28px;
  border:1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(12,16,34,.92), rgba(12,16,34,.62));
  box-shadow: var(--shadow);
  padding:14px;
  overflow:hidden;
  position:relative;
  backdrop-filter: blur(16px);
}
.matchBox:before{
  content:"";
  position:absolute; inset:-120px auto auto -120px;
  width:340px;height:340px;
  background: radial-gradient(circle at 30% 30%, rgba(108,92,231,.28), transparent 60%);
  pointer-events:none;
  filter: blur(2px);
}

.matchHead{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  margin-bottom:10px; position:relative; z-index:1;
}
.matchTitle{font-weight:1000; letter-spacing:-.2px}
.spinner{
  width:10px;height:10px;border-radius:99px;
  background:var(--accent);
  box-shadow:0 0 22px rgba(0,245,160,.6);
  animation:pulse .9s infinite ease-in-out;
}
@keyframes pulse{0%,100%{transform:scale(1);opacity:.55}50%{transform:scale(1.4);opacity:1}}

.slot{
  height:360px;
  border-radius:22px;
  border:1px solid rgba(255,255,255,.14);
  background:#070b18;
  overflow:hidden;
  position:relative;
  z-index:1;
}
.slotImg{
  position:absolute; inset:0;
  background-size:cover; background-position:center;
  transform:scale(1.06);
  filter:saturate(1.12) contrast(1.06);
  transition: opacity .14s ease, transform .22s ease;
  opacity:1;
}
.slotGlow{
  position:absolute; inset:-1px;
  border-radius:22px;
  border:2px solid rgba(0,210,255,.55);
  box-shadow: 0 0 42px rgba(0,210,255,.18), inset 0 0 28px rgba(0,245,160,.10);
  pointer-events:none;
  opacity:.85;
}
.slotFooter{
  display:flex; justify-content:space-between; align-items:center;
  margin-top:10px;
  color:rgba(243,247,255,.68);
  font-size:12px;
  position:relative; z-index:1;
}

/* Modal */
.modal{
  position:fixed; inset:0;
  background: rgba(0,0,0,.74);
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:60;
}
.modal.show{display:flex}

.modalCard{
  width:min(440px, 100%);
  border-radius:28px;
  border:1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(12,16,34,.95), rgba(12,16,34,.70));
  box-shadow: var(--shadow);
  overflow:hidden;
  position:relative;
  backdrop-filter: blur(16px);
  transform: translateY(14px) scale(.98);
  animation: popIn .18s ease-out forwards;
}

/* Flashing border layer (added on modal open) */
.modalCard.flash-border::after{
  content:"";
  position:absolute;
  inset:-2px;
  border-radius:30px;
  background: conic-gradient(from 120deg,
    rgba(0,245,160,.95),
    rgba(0,210,255,.95),
    rgba(108,92,231,.95),
    rgba(0,245,160,.95)
  );
  filter: blur(.6px);
  z-index:0;
  animation: flashGlow 900ms ease-out 1;
  opacity:0;
}
.modalCard.flash-border::before{
  content:"";
  position:absolute;
  inset:2px;
  border-radius:26px;
  background: linear-gradient(180deg, rgba(12,16,34,.95), rgba(12,16,34,.72));
  z-index:1;
}
.modalCard > *{position:relative; z-index:2;}

@keyframes popIn{
  to{transform: translateY(0) scale(1)}
}
@keyframes flashGlow{
  0%{opacity:0; transform:scale(.98)}
  18%{opacity:1; transform:scale(1)}
  55%{opacity:.65}
  100%{opacity:0}
}

/* Light shake (added on modal open) */
.modalCard.shake{
  animation: popIn .18s ease-out forwards, shake 420ms ease-in-out 1;
}
@keyframes shake{
  0%{transform: translateY(12px) scale(.985)}
  15%{transform: translateY(0) scale(1) translateX(-4px) rotate(-.4deg)}
  30%{transform: translateY(0) scale(1) translateX(4px) rotate(.4deg)}
  45%{transform: translateY(0) scale(1) translateX(-3px) rotate(-.3deg)}
  60%{transform: translateY(0) scale(1) translateX(3px) rotate(.3deg)}
  75%{transform: translateY(0) scale(1) translateX(-2px)}
  100%{transform: translateY(0) scale(1) translateX(0)}
}

.close{
  position:absolute; top:10px; right:10px;
  width:42px;height:42px;border-radius:16px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  color:var(--text);
  cursor:pointer;
  font-size:18px;
  line-height:42px;
  text-align:center;
  z-index:3;
}

.resultImg{
  height:420px;
  background-size:cover;
  background-position:center;
  position:relative;
}
.resultImg:after{
  content:"";
  position:absolute; left:0; right:0; bottom:0;
  height:140px;
  background: linear-gradient(180deg, transparent, rgba(12,16,34,.92));
  pointer-events:none;
}

.modalBody{padding:14px 14px 16px;}
.modalTitle{margin:0 0 6px; font-size:15px; font-weight:1000;}
.modalNote{margin:0 0 12px; color:rgba(243,247,255,.68); font-size:12px; line-height:1.6;}

.contactBtn{
  width:100%;
  height:54px;
  border:none;
  border-radius:20px;
  cursor:pointer;
  font-weight:1000;
  color:#061018;
  background: linear-gradient(135deg, rgba(0,245,160,1), rgba(108,92,231,1));
  box-shadow: 0 18px 40px rgba(108,92,231,.18), 0 12px 32px rgba(0,245,160,.14);
}
.contactBtn:active{transform:translateY(1px)}

.footTiny{margin-top:10px; color:rgba(243,247,255,.55); font-size:11px; line-height:1.45; text-align:center;}
