:root{
  --bg: #0b0c10;
  --panel: #13151b;
  --muted: #9aa1a9;
  --text: #e9edf1;
  --accent: #4f8cff;
  --accent-2: #7aa2ff;
  --danger: #ff5a5a;
  --ring: 0 0 0 3px rgba(79,140,255,0.35);
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --control-py: 18px;
  --control-fs: clamp(22px, 4vw, 28px);
  /* OTP 블록/셀/폰트/간격을 한 번에 조정할 변수 */
  --otp-block-w: clamp(320px, 70vw, 500px);   /* 4칸 전체 가로폭(=버튼 폭) */
  --otp-cell-size: clamp(76px, 12vw, 110px);   /* 한 칸 높이(정사각형 느낌) */
  --otp-font-size: clamp(32px, 9vw, 44px);    /* 숫자 폰트 */
  --otp-gap: clamp(10px, 3vw, 16px);         /* 칸 사이 간격 */
  --otp-btn-gap: clamp(14px, 3vw, 28px);      /* OTP와 버튼 사이 간격 */
}

*{ box-sizing: border-box; }
html, body{ height: 100%; overflow-x: hidden;}
body{
  margin:0;
  background: linear-gradient(180deg, #0a1a2f, #0d223d 30%, #0a1a2f);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", Arial, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 20px;
}

.page{
  min-height:100svh;
  display:flex;
  flex-direction:column;
}

.header{
  padding: clamp(16px, 3vw, 32px) clamp(16px, 4vw, 48px);
  text-align: center;
}
.header-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.header-img {
  width: clamp(180px, 50vw, 500px); /* 반응형 폭 */
  max-width: 90%;                   /* 화면의 90% 이상은 안 차게 */
  height: auto;                     /* 비율 유지 */
  margin-bottom: clamp(12px, 2vw, 24px);
}

/* .header-img {   */
/*  max-width: 240px; */
/*  width: 50%;           */
/*  height: auto;*/
/*  margin-bottom: 12px;*/
/*}   */

/*@media (max-width: 480px) {   */
/*  .header-img { */
/*    max-width: 180px;   */
/*    width: 70%; */
/*  } */
/*}    */
  
.title{
  margin: 0 0 6px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.02em;
}
.subtitle{
  margin:0;
  color: var(--muted);
  font-size: clamp(14px, 2vw, 16px);
}

.container{
  padding: 0 clamp(16px, 4vw, 48px) clamp(32px, 5vw, 64px);
  display:grid;
  gap:24px;
  grid-template-columns: 1fr;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.card{
  background: linear-gradient(180deg, #162235, #101a2a);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 3vw, 24px);
}

/* 4칸 입력 그룹 */
.otp-group{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--otp-gap);
  width: var(--otp-block-w);
  margin: 0 auto;
  align-items: center;
  justify-items: center;
}

.otp-input{
  width: 100%;
  height: var(--otp-cell-size);
  text-align: center;
  font-size: var(--otp-font-size);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: #0c1018;
  color: var(--text);
  outline: none;
  transition: box-shadow .2s, border-color .2s, transform .06s;
}

.otp-input:focus{
  border-color: var(--accent);
  box-shadow: var(--ring);
}

/* 폼이 화면 중앙에 있을 때 */
.form-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100svh - 140px); /* 헤더 높이 제외한 중앙 배치 */
  transition: all 0.4s ease;
}

/* 폼이 상단으로 이동했을 때 */
.form-wrapper.top {
  justify-content: flex-start;
  align-items: flex-start;
  min-height: auto;
  padding-top: 16px;
}

.form{
  display: grid;
  gap: 10px;
  /* 버튼을 입력 밑으로 내리고, 전체 폭을 쓰게 */
  grid-template-columns: 1fr;
  grid-template-areas:
    "label"
    "input"
    "submit"
    "error";
  align-items: stretch;
}

.input-label{ grid-area: label; }
.input{ grid-area: input; }
.otp-group{ grid-area: input; }
.btn.primary.submit-btn{ grid-area: submit; }
.error{ grid-area: error; }

.input-label{
  font-size: 14px;
  color: var(--muted);
}

.input{
  width:100%;
  font-size: clamp(22px, 4vw, 28px);
  padding: 18px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1);
  background: #0c1018;
  color: var(--text);
  outline: none;
  transition: box-shadow .2s, border-color .2s, transform .06s;
}
.input:focus{
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  height: 56px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1);
  background: #171b25;
  color: var(--text);
  font-size: clamp(16px, 2.6vw, 18px);
  cursor: pointer;
  transition: transform .06s, background .2s, border-color .2s, opacity .2s;
  user-select: none;
}
.btn:hover{ background:#1d2330; }
.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity: .5; cursor:not-allowed; }

.btn.primary{
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: white;
}
.btn.ghost{
  background: transparent;
  border-color: rgba(255,255,255,.16);
}

.btn.primary.submit-btn{
  width: var(--otp-block-w);   /* OTP와 동일 가로 폭 */
  margin: var(--otp-btn-gap) auto 0; /* OTP와 버튼 사이 간격 ↑ */
  padding: var(--control-py) 20px;
  height: auto;
  font-size: var(--control-fs);  /* 버튼 폰트는 기존대로 */
  line-height: 1.2;
  align-self: auto;
  justify-self: center;
}

.error{
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.table-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.table-title{
  margin:0;
  font-size: clamp(18px, 3vw, 22px);
}
.badge{
  display:inline-flex;
  align-items:center;
  height:28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #1a2130;
  border: 1px solid rgba(255,255,255,.1);
  color: var(--muted);
  font-size: 13px;
}

.table-responsive{
  overflow:auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
}
.table{
  width:100%;
  border-collapse: collapse;
  background: #0e131c;
  table-layout: fixed; /* colgroup 기반으로 안정화 */
}
.table { table-layout: fixed; }
.table .col-action { width: 150px; } /* 120~180px 선호 범위 */

/* 액션(선택 버튼) 컬럼 고정폭 */
.table .col-action { width: 150px; } /* 필요시 120~180px 범위로 조절 */

.table th, .table td{
  text-align:left;
  padding: clamp(14px, 2.5vw, 20px) clamp(16px, 3vw, 24px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: clamp(16px, 3.2vw, 20px); /* 화면에 맞춰 글씨 크기 조정 */
}
.table th{
  font-weight: 600;
  color: #cfd6df;
  background: #121826;
  font-size: clamp(17px, 3.5vw, 22px); /* 헤더 글씨도 확대 */
}
.table tbody tr:hover{
  background: rgba(79,140,255,0.07);
}
.table-wrap{
  margin-top: clamp(16px, 4vw, 28px); /* 폼과 살짝 띄우기 */
}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
plate-text{
  letter-spacing: .5px;
  text-align: center; /* 중앙 정렬 */
  font-weight: 600;
}
td.plate-text{
  letter-spacing: .5px;
  text-align: center; /* 중앙 정렬 */
  font-weight: 600;
  font-size: clamp(18px, 4vw, 24px); /* 반응형 확대 */
}
/* 현재는 2컬럼 구조: 첫 번째(차 번호)만 중앙 */
.table th:nth-child(1) { 
  text-align: center; 
  font-size: clamp(18px, 4vw, 26px); /* 반응형 확대 */
}


/* 선택 버튼 셀 왼쪽 정렬 */
td.select-cell {
  text-align: center; /* 왼쪽 정렬 */
  padding-left: 0px; /* 필요시 여백 조절 */
}

/* 버튼 크기 균일하게 */
td.select-cell .btn {
  min-width: clamp(80px, 20vw, 120px);   /* 반응형 폭 */
  height: clamp(40px, 8vw, 54px);        /* 반응형 높이 */
  font-size: clamp(15px, 3.5vw, 18px);   /* 글씨 크기 확대 */
  border-radius: 12px;                   /* 살짝 둥글게 */
  justify-content: center;
}

.modal-backdrop{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display:flex; 
  align-items:center; 
  justify-content:center;
  padding: 24px;
  z-index: 9999;
}
.modal{
  width: 600px;
  max-width: 90%;
  padding: 48px 32px;
  background: linear-gradient(180deg, #17283f, #101a2a);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,.5);
  overflow: hidden;
}
/* 반응형 */
@media (max-width: 768px) {
  .modal {
    width: 95%;
    padding: 40px 24px;
  }
}
/* 본문만 사용: 중앙 텍스트 + 하단 중앙 버튼 */
.modal-body{
  padding: clamp(22px, 4vw, 32px) clamp(20px, 4vw, 28px);
}
.modal-body.centered{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 3.5vw, 24px);
  text-align: center;
}
/* 텍스트 */
.modal-text {
  font-size: clamp(20px, 2.5vw, 28px);
  margin-bottom: 48px; /* 버튼과 간격 넓힘 */
  line-height: 1.6;
}

/* 버튼 컨테이너 */
.modal-actions {
  display: flex;
  justify-content: center; /* 가운데 정렬 */
  gap: 24px;
}

/* 버튼 스타일 */
.modal-actions .btn {
  font-size: clamp(18px, 2vw, 22px);
  padding: 14px 28px;
  border-radius: 8px;
}
.modal-actions.centered{
  justify-content: center; /* 버튼 중앙 정렬 */
}

.icon-btn{
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}


.footer{
  margin-top: auto;
  padding: 18px 24px 28px;
  text-align:center;
  color: var(--muted);
  font-size: 13px;
  opacity:.8;
}



/* 데스크톱에서도 버튼은 OTP 아래에 유지 */
@media (min-width: 720px){
  .form{
    grid-template-columns: 1fr;
    grid-template-areas:
      "label"
      "input"
      "submit"
      "error";
  }
}

.loading-backdrop{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(1.5px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.loading-card{
  background: linear-gradient(180deg, #17283f, #101a2a);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: clamp(18px, 4vw, 28px) clamp(18px, 5vw, 32px);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 3vw, 16px);
}
.spinner{
  width: clamp(36px, 8vw, 56px);
  height: clamp(36px, 8vw, 56px);
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.2);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.loading-text{
  font-size: clamp(16px, 3.5vw, 20px);
  color: var(--text);
  opacity: .9;
  margin: 0;
}
@keyframes spin{ to { transform: rotate(360deg); } }

/* 모션 최소화 환경 배려 */
@media (prefers-reduced-motion: reduce){
  .spinner{ animation: none; border-top-color: rgba(255,255,255,.6); }
}
