:root {
  --ink: #14171b;
  --muted: #6e747d;
  --line: #e7e9ed;
  --paper: #f5f3ee;
  --card: #ffffff;
  --brand: #15b89a;
  --brand-dark: #0d927b;
  --danger: #c65345;
  --shadow: 0 18px 60px rgba(25, 31, 38, .12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 2%, rgba(21, 184, 154, .14), transparent 34%),
    radial-gradient(circle at 92% 96%, rgba(227, 151, 71, .12), transparent 36%),
    var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.kiosk-page {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  padding: 18px 28px 16px;
  padding: max(18px, env(safe-area-inset-top)) 28px
    max(16px, env(safe-area-inset-bottom));
}

.kiosk-shell {
  display: grid;
  width: 100%;
  max-width: 1440px;
  min-height: calc(100vh - 34px);
  margin: 0 auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.kiosk-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 6px 17px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-dark);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .15em;
}

.kiosk-header h1 {
  margin: 0;
  font-size: 56px;
  font-size: clamp(46px, 5.6vw, 66px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.055em;
}

.free-parking {
  margin: 10px 0 0;
  color: var(--brand-dark);
  font-size: 31px;
  font-weight: 760;
  line-height: 1.18;
  letter-spacing: -.03em;
}

.status-pill {
  display: flex;
  min-width: 92px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 7px;
  border: 1px solid rgba(20, 23, 27, .08);
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aeb4bc;
}

.status-pill.online .status-dot {
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(21, 184, 154, .13);
}

.status-pill.working .status-dot {
  background: #e2963c;
}

.status-pill.offline .status-dot {
  background: var(--danger);
}

.kiosk-stage {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(300px, .82fr) minmax(0, 1.18fr);
  gap: 24px;
}

.guide-panel {
  display: flex;
  min-height: 0;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  padding: 18px 10px 18px 14px;
}

.qr-card {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  padding: 22px;
  padding: clamp(16px, 2.2vw, 26px);
  border: 1px solid rgba(20, 23, 27, .06);
  border-radius: 32px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.qr-wrap {
  position: relative;
  display: grid;
  width: min(61vh, 100%, 540px);
  height: min(61vh, 100vw, 540px);
  max-height: 100%;
  min-width: 220px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  place-items: center;
  border: 10px solid #fff;
  border-radius: 20px;
  background: #fff;
}

.qr-wrap img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.qr-wrap.has-image img {
  display: block;
}

.qr-wrap.has-image .qr-placeholder {
  display: none;
}

.qr-placeholder,
.qr-overlay {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.qr-overlay {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 24px;
  background: rgba(255, 255, 255, .94);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.qr-overlay strong {
  color: var(--ink);
  font-size: 18px;
}

.qr-wrap.pending .qr-overlay,
.qr-wrap.blocked .qr-overlay {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(21, 184, 154, .16);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

.scan-hint {
  max-width: 340px;
  margin: 0 0 15px;
  font-size: 31px;
  font-size: clamp(27px, 3vw, 37px);
  font-weight: 760;
  line-height: 1.18;
  letter-spacing: -.03em;
}

.qr-note {
  margin: 0 0 27px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  text-align: left;
}

.guide-step {
  width: min(100%, 340px);
}

.step-label {
  color: var(--brand-dark);
  font-size: 31px;
  font-weight: 760;
  line-height: 1.18;
  letter-spacing: -.03em;
}

.step-title {
  margin: 7px 0 20px;
  font-size: 31px;
  font-weight: 760;
  line-height: 1.18;
  letter-spacing: -.03em;
}

.guide-step-secondary {
  margin-top: 22px;
}

.guide-step-secondary .step-title {
  margin-bottom: 0;
}

.refresh-button {
  display: flex;
  width: min(100%, 330px);
  min-height: 64px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 0;
  border: 0;
  border-radius: 18px;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(20, 23, 27, .18);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}

.refresh-button:active {
  transform: translateY(1px);
  background: #292d33;
}

.refresh-button:disabled {
  opacity: .48;
}

.refresh-icon {
  display: inline-block;
  font-size: 23px;
  line-height: 1;
}

.refresh-button.working .refresh-icon {
  animation: spin .8s linear infinite;
}

.refresh-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
}

.refresh-message.error {
  color: var(--danger);
}

.support-note {
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.support-note span {
  display: block;
}

.support-note strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 23px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .075em;
}

.kiosk-footer {
  display: flex;
  justify-content: space-between;
  padding: 15px 8px 2px;
  color: #92979f;
  font-size: 12px;
}

/* Operator-only recovery console */

.operator-page {
  padding: 24px;
  background: #eef1f4;
}

.operator-shell {
  max-width: 1240px;
  margin: 0 auto;
}

.operator-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.operator-head h1 {
  margin: 0;
  font-size: 26px;
}

.operator-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.operator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr);
  gap: 18px;
}

.operator-panel {
  border: 1px solid #dfe3e8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(23, 31, 40, .06);
}

.operator-panel h2 {
  margin: 0;
  padding: 17px 20px;
  border-bottom: 1px solid #eceff2;
  font-size: 16px;
}

.operator-panel-body {
  padding: 18px 20px 21px;
}

.operator-screen {
  display: block;
  width: 100%;
  max-height: 72vh;
  border-radius: 11px;
  background: #1b1d21;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

.operator-status {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f5f7f9;
  color: #535b66;
  font-size: 13px;
  line-height: 1.55;
}

.operator-actions {
  display: grid;
  gap: 10px;
}

.operator-actions button {
  min-height: 44px;
  border: 1px solid #dce1e7;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
}

.operator-actions button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.operator-actions button:disabled {
  opacity: .5;
}

.operator-input {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.operator-input input {
  min-width: 0;
  flex: 1;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #dce1e7;
  border-radius: 10px;
  background: #fff;
}

.operator-input button {
  padding: 0 15px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.operator-help {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.operator-message {
  min-height: 20px;
  margin: 11px 0 0;
  color: var(--brand-dark);
  font-size: 13px;
}

.operator-message.error {
  color: var(--danger);
}

@media (max-width: 800px) {
  .operator-page {
    padding: 12px;
  }

  .operator-grid {
    grid-template-columns: 1fr;
  }

  .operator-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .operator-screen {
    max-height: none;
  }
}

@media (max-width: 900px), (orientation: portrait) {
  .kiosk-page {
    padding: 18px 16px 16px;
    padding: max(18px, env(safe-area-inset-top)) 16px
      max(16px, env(safe-area-inset-bottom));
  }

  .kiosk-shell {
    max-width: 760px;
    min-height: calc(100vh - 34px);
  }

  .kiosk-header {
    align-items: flex-start;
  }

  .kiosk-header h1 {
    max-width: 420px;
    font-size: 48px;
    font-size: clamp(40px, 8vw, 58px);
  }

  .free-parking {
    margin-top: 8px;
    font-size: 25px;
  }

  .step-label {
    font-size: 25px;
  }

  .status-pill {
    margin-top: 4px;
    margin-bottom: 0;
  }

  .kiosk-stage {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
  }

  .qr-card {
    min-height: 0;
    flex: 1;
    padding: 18px;
  }

  .qr-wrap {
    width: min(62vh, 100%, 520px);
    height: min(62vh, 100vw, 520px);
    max-height: 100%;
  }

  .guide-panel {
    align-items: center;
    padding: 2px 8px 10px;
    text-align: center;
  }

  .scan-hint {
    margin: 0 0 8px;
    font-size: 25px;
    line-height: 1.2;
  }

  .guide-step {
    width: min(100%, 420px);
  }

  .step-title {
    margin-bottom: 12px;
    font-size: 25px;
  }

  .guide-step-secondary {
    margin-top: 16px;
  }

  .qr-note {
    margin: 0 0 16px;
    text-align: center;
  }

  .refresh-message {
    text-align: center;
  }
}

@media (max-height: 720px) {
  .kiosk-page {
    padding-top: 12px;
  }

  .kiosk-header {
    padding-bottom: 10px;
  }

  .scan-hint {
    margin-bottom: 10px;
  }

  .refresh-button {
    min-height: 50px;
    margin-top: 14px;
  }
}
