/* =========================================
   주스터콜 공성신청 — 모바일/데스크톱 통합 스타일
   ========================================= */

:root {
  --bg: #0c1015;
  --bg-grad: radial-gradient(1200px 600px at 50% -20%, #1a2434 0%, #0c1015 60%);
  --panel: #161b22;
  --panel-2: #1f262f;
  --panel-3: #262d37;
  --border: #2a313b;
  --border-strong: #3a424e;
  --text: #e6edf3;
  --muted: #8b949e;
  --muted-2: #6e7681;
  --accent: #ffb84a;
  --accent-2: #ff7e3c;
  --success: #2ea043;
  --danger: #f85149;
  --info: #58a6ff;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

/* hidden 속성을 모든 display 보다 우선 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
               "Noto Sans KR", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

button { font: inherit; cursor: pointer; }
input, select, textarea, button { font: inherit; color: inherit; }

/* ===== Header ===== */

.site-header {
  padding:
    calc(10px + var(--safe-top))
    calc(16px + var(--safe-right))
    14px
    calc(16px + var(--safe-left));
  text-align: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(12, 16, 21, 0.85);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
}

/* EU 깃발 바 */
.eu-flag-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(0, 51, 153, 0.3), rgba(0, 51, 153, 0.1));
  border: 1px solid rgba(255, 204, 0, 0.35);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.3px;
}

.eu-flag-svg {
  width: 28px;
  height: 19px;
  border-radius: 2px;
  display: block;
  box-shadow: 0 0 0 1px rgba(255, 204, 0, 0.2);
}

.eu-text {
  color: #FFCC00;
  font-weight: 700;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-icon { font-size: 22px; }

.site-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 18px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}

.back-link:hover { color: var(--accent); border-color: var(--accent); }

.guild-context {
  margin-top: 8px;
}

.guild-badge {
  display: inline-block;
  padding: 4px 12px;
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.15), rgba(0, 51, 153, 0.15));
  border: 1px solid rgba(255, 204, 0, 0.35);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  color: #FFCC00;
  letter-spacing: 0.3px;
}

.guild-badge.warn {
  background: rgba(248, 81, 73, 0.12);
  border-color: rgba(248, 81, 73, 0.5);
  color: var(--danger);
}

.guild-badge a {
  color: inherit;
  text-decoration: underline;
}

.today-banner {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13.5px;
}

.castle-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1c1300;
  font-weight: 700;
  font-size: 12.5px;
  white-space: nowrap;
}

.castle-tag.disabled {
  background: var(--panel-2);
  color: var(--muted);
}

/* ===== 공성 카운트다운 ===== */

.siege-countdown {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(0, 51, 153, 0.20), rgba(255, 204, 0, 0.10));
  border: 1px solid rgba(255, 204, 0, 0.35);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}

.siege-countdown .cd-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.siege-countdown .cd-time {
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #FFCC00;
  letter-spacing: 0.5px;
}

.siege-countdown.offday {
  background: linear-gradient(135deg, rgba(110, 118, 129, 0.18), rgba(110, 118, 129, 0.08));
  border-color: rgba(110, 118, 129, 0.30);
}

.siege-countdown.offday .cd-time {
  color: var(--muted);
}

.siege-countdown.urgent {
  background: linear-gradient(135deg, rgba(248, 81, 73, 0.25), rgba(248, 81, 73, 0.12));
  border-color: rgba(248, 81, 73, 0.55);
  animation: countdown-pulse 1.2s ease-in-out infinite;
}

.siege-countdown.urgent .cd-time {
  color: #ff8a82;
  text-shadow: 0 0 8px rgba(248, 81, 73, 0.45);
}

.siege-countdown.urgent .cd-label {
  color: #ff8a82;
  font-weight: 700;
}

@keyframes countdown-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(248, 81, 73, 0); }
}

/* ===== Layout ===== */

.layout {
  max-width: 720px;
  margin: 0 auto;
  padding:
    16px
    calc(16px + var(--safe-right))
    16px
    calc(16px + var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* desktop 2-column */
@media (min-width: 960px) {
  .layout {
    max-width: 1200px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    align-items: start;
    gap: 20px;
    padding-top: 24px;
    padding-bottom: 24px;
  }
  .list-card { position: sticky; top: 92px; max-height: calc(100vh - 110px); display: flex; flex-direction: column; }
  .list-card .table-wrap { flex: 1; overflow-y: auto; }
}

/* ===== Card ===== */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 480px) {
  .card { padding: 16px; border-radius: 12px; }
}

.card h2 {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
}

/* ===== Form fields ===== */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.field-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.field input[type="text"],
.field input[type="url"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px; /* iOS zoom 방지 */
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}

.field input:focus {
  border-color: var(--accent);
  background: var(--panel-3);
}

.field input::placeholder {
  color: var(--muted-2);
}

/* ===== Drop zone ===== */

.drop-zone {
  display: block;
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  padding: 28px 16px;
  background: var(--panel-2);
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  cursor: pointer;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.drop-zone:active { transform: scale(0.997); }
.drop-zone:hover { border-color: var(--accent); }
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(255, 184, 74, 0.08);
}

.drop-inner { pointer-events: none; }
.drop-icon { font-size: 32px; margin-bottom: 6px; }
.drop-title {
  margin: 0;
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}
.drop-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.preview-wrap {
  position: relative;
  margin: 14px 0 0;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

#preview {
  display: block;
  max-width: 100%;
  max-height: 280px;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: contain;
}

@media (min-width: 960px) {
  #preview { max-height: 360px; }
}

.crop-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  touch-action: none;
}

.crop-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 184, 74, 0.95);
  color: #1c1300;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
}

.crop-rect {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgba(255, 184, 74, 0.12);
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.preview-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.small-btn {
  padding: 7px 12px;
  font-size: 13px;
  min-height: 34px;
}

.link-btn-inline {
  background: transparent;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.link-btn-inline:hover { filter: brightness(1.15); }

/* ===== Segmented control (정예참전 여부) ===== */

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 380px) {
  .segmented { grid-template-columns: 1fr; }
}

.seg-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.seg-btn:hover { background: var(--panel-3); }
.seg-btn:active { transform: scale(0.97); }

.seg-btn.selected {
  background: rgba(255, 184, 74, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.elite-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.elite-O { background: rgba(46, 160, 67, 0.18); color: #69d586; }
.elite-X { background: rgba(248, 81, 73, 0.18); color: #ff8a82; }
.elite-MAX { background: rgba(88, 166, 255, 0.18); color: #6fb5ff; }
.elite-NONE { color: var(--muted-2); font-size: 11px; }

/* ===== OCR status / candidates ===== */

.ocr-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.25);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.4;
}

.spinner {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.candidate-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  transition: border-color 0.12s, background 0.12s, transform 0.06s;
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}

.candidate-chip:hover { border-color: var(--accent); background: var(--panel-3); }
.candidate-chip:active { transform: scale(0.96); }

.candidate-chip.primary-match {
  background: rgba(255, 184, 74, 0.14);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.raw-ocr {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  font-size: 12.5px;
}

.raw-ocr summary {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}

.raw-ocr summary:hover { color: var(--text); }

.raw-ocr pre {
  margin: 0;
  padding: 0 12px 12px;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

/* ===== Buttons ===== */

.primary, .ghost {
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  border: 1px solid transparent;
  transition: filter 0.15s, background 0.15s, transform 0.05s;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1c1300;
  font-weight: 700;
}

.primary:hover { filter: brightness(1.08); }
.primary:active { transform: scale(0.98); }
.primary:disabled { opacity: 0.55; cursor: not-allowed; filter: none; transform: none; }

.submit-btn { width: 100%; font-size: 16px; padding: 12px 16px; min-height: 56px; flex-direction: column; gap: 2px; line-height: 1.15; }
.submit-btn small { font-size: 11px; font-weight: 600; opacity: 0.75; }

.submit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.submit-btn.variant-update {
  background: linear-gradient(135deg, #58a6ff, #3a76d8);
  color: #061330;
}
.submit-btn.variant-update:hover { filter: brightness(1.1); }

.ghost {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text);
}
.ghost:hover { background: var(--panel-3); }
.ghost:active { transform: scale(0.98); }

.icon-btn { width: 36px; height: 36px; padding: 0; min-height: 36px; }
.icon-btn svg { display: block; }

/* ===== 다계정 추가 등록 ===== */
.multi-acc-section {
  margin: 6px 0 14px;
  border: 1px dashed rgba(255, 184, 74, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(255, 184, 74, 0.04);
  overflow: hidden;
}

.multi-acc-toggle {
  cursor: pointer;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}

.multi-acc-toggle::-webkit-details-marker { display: none; }
.multi-acc-toggle::after {
  content: "▼";
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.2s;
  margin-left: 8px;
}
.multi-acc-section[open] .multi-acc-toggle::after { transform: rotate(180deg); }

.multi-acc-toggle:hover { background: rgba(255, 184, 74, 0.06); }
.multi-acc-toggle-label { display: inline-flex; align-items: center; gap: 6px; }
.multi-acc-count {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  background: var(--panel-2);
  padding: 2px 9px;
  border-radius: 999px;
}
.multi-acc-count.active {
  background: rgba(255, 184, 74, 0.18);
  color: var(--accent);
  font-weight: 700;
}

.multi-acc-section[open] .multi-acc-toggle { border-bottom: 1px solid var(--border); }

.multi-acc-hint {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

.multi-acc-hint strong { color: var(--accent); }

.multi-acc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
}

.multi-acc-list:empty { display: none; }

.multi-acc-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  transition: border-color 0.15s;
}

.multi-acc-row:focus-within { border-color: var(--accent); }

.multi-acc-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.multi-acc-num {
  flex: 0 0 auto;
  font-weight: 800;
  color: var(--accent);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 184, 74, 0.14);
  padding: 5px 10px;
  border-radius: 6px;
  text-align: center;
}

.multi-acc-row input[type="text"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 11px;
  font-size: 14px;
  outline: none;
  min-width: 0;
  transition: border-color 0.15s;
}

.multi-acc-row input[type="text"]:focus { border-color: var(--accent); }

.multi-nick {
  flex: 1 1 auto;
  font-weight: 600;
}

/* 행 안의 작은 드롭존 */
.multi-drop-zone {
  display: block;
  background: var(--panel-2);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  cursor: pointer;
  text-align: center;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

.multi-drop-zone:hover { border-color: var(--accent); }
.multi-drop-zone:active { transform: scale(0.997); }

.multi-drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(255, 184, 74, 0.08);
}

.multi-drop-zone.processing { border-color: var(--accent); border-style: solid; }
.multi-drop-zone.done {
  border-color: var(--success);
  border-style: solid;
  background: rgba(46, 160, 67, 0.06);
}
.multi-drop-zone.error-state {
  border-color: var(--danger);
  border-style: solid;
  background: rgba(248, 81, 73, 0.06);
}

.multi-drop-zone input[type="file"] { display: none; }

.multi-drop-default {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.multi-drop-icon { font-size: 22px; }
.multi-drop-text { font-size: 13.5px; color: var(--text); font-weight: 600; }
.multi-drop-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.multi-drop-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  text-align: left;
}

.multi-drop-img {
  width: 60px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.multi-drop-status {
  flex: 1;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.multi-drop-status .multi-drop-spinner {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.multi-drop-status.success { color: #69d586; font-weight: 600; }
.multi-drop-status.error { color: #ff8a82; }

.multi-drop-zone .multi-drop-clear {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  padding: 0;
  line-height: 1;
}

.multi-drop-zone.has-file .multi-drop-clear { display: flex; }
.multi-drop-zone.has-file .multi-drop-clear:hover { background: var(--danger); }

.multi-acc-row-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.multi-score {
  flex: 1 1 110px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.multi-elite-mini {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.multi-elite-mini button {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 14px;
  cursor: pointer;
  min-width: 36px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}

.multi-elite-mini button:hover { background: rgba(255, 184, 74, 0.08); }

.multi-elite-mini button.selected {
  background: rgba(255, 184, 74, 0.22);
  outline: 1px solid var(--accent);
}

.multi-rm {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  width: 32px;
  height: 32px;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.multi-rm:hover {
  background: rgba(248, 81, 73, 0.18);
  color: var(--danger);
  border-color: rgba(248, 81, 73, 0.4);
}

.multi-acc-actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .multi-acc-row { padding: 9px; gap: 7px; }
  .multi-acc-num { font-size: 12px; padding: 4px 8px; }
  .multi-acc-row input[type="text"] { padding: 8px 10px; font-size: 13.5px; }
  .multi-drop-zone { padding: 12px 10px; }
  .multi-drop-icon { font-size: 18px; }
  .multi-drop-text { font-size: 12.5px; }
  .multi-drop-img { width: 48px; height: 34px; }
  .multi-elite-mini button { padding: 6px 8px; min-width: 32px; min-height: 30px; font-size: 13px; }
  .multi-rm { width: 30px; height: 30px; }
  .multi-acc-toggle { padding: 10px 12px; font-size: 13.5px; }
  .multi-acc-hint { font-size: 11.5px; padding: 9px 12px; }
}

/* ===== Messages / hints ===== */

.hint {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0;
  text-align: center;
  min-height: 1.2em;
}

.hint.error { color: var(--danger); font-weight: 600; }
.hint.success { color: var(--success); font-weight: 600; }

/* ===== List card ===== */

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.list-header h2 { margin: 0; font-size: 17px; font-weight: 700; }

.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-bar select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13.5px;
  cursor: pointer;
  outline: none;
  height: 36px;
}

.filter-bar select:focus { border-color: var(--accent); }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

/* 컬럼 너비: 성/닉네임/점수/정예/시간/비고 */
table col.col-castle { width: 64px; }
table col.col-nick { width: 82px; }
table col.col-score { width: 80px; }
table col.col-elite { width: 70px; }
table col.col-time { width: 80px; }
table col.col-note { width: auto; }

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
  white-space: nowrap;
}

th.num, td.num { text-align: right; }

td.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 12px;
  font-size: 13.5px;
  white-space: normal;
}

tbody tr { transition: background 0.1s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.score-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.castle-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.2px;
  line-height: 1.4;
}

.pill-주작성 { background: rgba(248, 81, 73, 0.18); color: #ff8a82; }
.pill-현무성 { background: rgba(88, 166, 255, 0.18); color: #6fb5ff; }
.pill-청룡성 { background: rgba(46, 160, 67, 0.18); color: #69d586; }
.pill-백호성 { background: rgba(230, 237, 243, 0.20); color: #e6edf3; }

.time-cell {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.nick-cell {
  font-weight: 600;
  white-space: nowrap;
}

.note-cell {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

/* ===== Dialog ===== */

.dialog {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 380px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.dialog h3 { margin: 0 0 10px; font-size: 18px; font-weight: 700; }
.dialog p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }

.dialog input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
}

.dialog input:focus { border-color: var(--accent); }

.dialog menu {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0;
  margin: 0;
}

/* ===== Footer ===== */

.site-footer {
  padding:
    24px
    calc(16px + var(--safe-right))
    calc(32px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(0, 51, 153, 0.05));
}

.footer-line {
  margin: 4px 0;
}

.footer-powered {
  font-size: 13px;
  color: #FFCC00;
  letter-spacing: 0.5px;
  margin: 8px 0;
}

.footer-powered strong {
  color: #FFCC00;
  font-weight: 800;
}

.eu-stars-mini {
  color: #FFCC00;
  letter-spacing: 2px;
  font-size: 9px;
  opacity: 0.85;
  margin: 0 6px;
}

.footer-admin {
  margin-top: 8px;
  font-size: 11px;
  opacity: 0.7;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
  padding: 4px 6px;
}

.site-footer a:hover { text-decoration: underline; }

.dialog-warn h3 { color: var(--danger); }
.dialog-warn p { color: var(--text); font-size: 14.5px; line-height: 1.6; }

/* ===== Animations ===== */

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

tbody tr.new {
  animation: pop-in 0.3s ease;
}

/* ===== Mobile fine tuning ===== */

@media (max-width: 640px) {
  .layout { padding-left: calc(12px + var(--safe-left)); padding-right: calc(12px + var(--safe-right)); gap: 14px; }
  .site-header h1 { font-size: 18px; }
  .brand-icon { font-size: 20px; }
  .today-banner { font-size: 12.5px; padding: 5px 12px; }
  .card h2, .list-header h2 { font-size: 16px; }
  .card { padding: 16px; }

  .field input[type="text"],
  .field input[type="url"] { padding: 11px 13px; }

  .drop-zone { padding: 22px 12px; }
  .drop-icon { font-size: 28px; }
  .drop-title { font-size: 14px; }
  .drop-sub { font-size: 11.5px; }

  .seg-btn {
    padding: 10px 4px;
    font-size: 13px;
    line-height: 1.2;
    word-break: keep-all;
  }

  .submit-btn { font-size: 15px; min-height: 52px; }
  .submit-btn small { font-size: 10.5px; }

  th, td { padding: 9px 7px; font-size: 13px; }
  th { font-size: 10.5px; }

  table col.col-castle { width: 56px; }
  table col.col-nick { width: 74px; }
  table col.col-score { width: 72px; }
  table col.col-elite { width: 56px; }
  table col.col-time { width: 70px; }

  .castle-pill { font-size: 10.5px; padding: 2px 7px; }
  .filter-bar select { font-size: 12.5px; padding: 7px 10px; height: 34px; }
}

@media (max-width: 480px) {
  .site-header { padding-left: calc(12px + var(--safe-right)); padding-right: calc(12px + var(--safe-left)); }
  .site-header h1 { font-size: 17px; }
  .today-banner { font-size: 12px; }
  .castle-tag { font-size: 11.5px; padding: 2px 8px; }
  .guild-badge { font-size: 11.5px; padding: 3px 10px; }

  .submit-row { gap: 8px; }
  .submit-btn { font-size: 14.5px; }
  .submit-btn small { font-size: 10px; }

  .ocr-status { font-size: 12.5px; padding: 9px 11px; }
  .candidate-chip { font-size: 13px; padding: 8px 12px; }
}

@media (max-width: 380px) {
  .seg-btn { font-size: 12px; padding: 9px 2px; }
  .submit-btn { font-size: 13.5px; min-height: 48px; }
  .submit-btn small { font-size: 9.5px; }
  th, td { padding: 8px 5px; font-size: 12px; }
  th { font-size: 10px; }
}

/* ===== Print (just in case) ===== */
@media print {
  .site-header, .site-footer, #formCard { display: none; }
  body { background: white; color: black; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}
