
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f3efe8;
  color: #1f2937;
}

.member-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(212,175,55,.10), transparent 18%),
    linear-gradient(180deg, #f5f1ea 0%, #f3efe8 100%);
}

.topbar {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 22px 0 12px;
}

.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-group {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.brand-logo {
  display: block;
  width: 140px;
  max-width: 40vw;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.15));
  transition: transform .25s ease;
}

.brand-logo:hover {
  transform: scale(1.05);
}

.app-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 18px 28px;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 18px;
}

.main-panel {
  min-width: 0;
}

.panel-stack {
  position: relative;
  margin-bottom: 24px;
}

.panel-shadow-1,
.panel-shadow-2 {
  position: absolute;
  inset: 20px -12px -20px 20px;
  border-radius: 18px;
  background: rgba(0,0,0,.08);
  transform: rotate(-8deg);
  pointer-events: none;
}

.panel-shadow-2 {
  inset: 40px -24px -40px 42px;
  transform: rotate(-14deg);
  opacity: .7;
}

.member-panel {
  position: relative;
  z-index: 2;
  background: white;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(0,0,0,.12);
  padding: 22px;
  min-height: 380px;
}

.member-view {
  display: none;
}

.member-view.active {
  display: block;
}

.profile-head {
  text-align: center;
  margin-bottom: 18px;
}

.profile-name {
  font-size: 42px;
  font-weight: 900;
  margin: 0 0 8px;
  color: #111827;
  word-break: break-word;
}

.profile-sub {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 12px;
}

.action-btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 18px 20px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}

.action-btn.primary {
  background: #9f0505;
  color: white;
  margin-bottom: 14px;
}

.action-btn.secondary {
  background: #d8a15a;
  color: white;
}

.qr-card {
  background: linear-gradient(135deg, #1f1f1f 0%, #2a2a2a 100%);
  color: white;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}

.qr-grid {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.qr-box {
  width: 244px;
  min-height: 244px;
  background: white;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#dynamic-qrcode {
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#dynamic-qrcode img,
#dynamic-qrcode canvas {
  width: 220px !important;
  height: 220px !important;
  max-width: 100% !important;
  display: block;
}

.member-code-inline {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .5px;
}

.qr-side {
  text-align: center;
}

.timer-circle {
  width: 120px;
  height: 120px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 10px solid rgba(255,255,255,.14);
  border-top-color: #1d4ed8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: spinBorder 1s linear infinite;
}

.timer-seconds {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.timer-label {
  font-size: 12px;
  opacity: .86;
  margin-top: 4px;
}

.timer-datetime {
  font-size: 14px;
  opacity: .9;
  margin-top: 8px;
}

.back-btn {
  margin-top: 16px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px;
  font-size: 16px;
  font-weight: 800;
  background: #d8a15a;
  color: white;
}

.qr-note {
  text-align: center;
  margin-top: 16px;
  color: rgba(255,255,255,.78);
  font-size: 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
}

.info-block {
  display: grid;
  gap: 12px;
}

.info-box {
  background: #f6f6f6;
  border-radius: 16px;
  padding: 16px;
}

.info-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.info-value-lg {
  font-size: 40px;
  font-weight: 900;
  color: #111827;
  line-height: 1;
}

.info-value {
  font-size: 16px;
  font-weight: 800;
  word-break: break-word;
}

#member-info-qrcode {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#member-info-qrcode img,
#member-info-qrcode canvas {
  width: 160px !important;
  height: 160px !important;
  max-width: 100% !important;
  display: block;
}

.history-section {
  margin-top: 20px;
}

.section-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 12px;
}

.card {
  border-radius: 16px;
  background: white;
  padding: 14px 16px;
  margin: 10px 0;
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 16px;
}

.history-type {
  font-weight: 800;
}

.history-points.plus {
  color: #15803d;
  font-weight: 900;
}

.history-points.minus {
  color: #b91c1c;
  font-weight: 900;
}

.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.loading-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
  padding: 34px 26px;
  border-radius: 24px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  backdrop-filter: blur(8px);
}

.loading-logo {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 4px solid rgba(250,204,21,.18);
  border-top-color: #facc15;
  animation: spinBorder 1s linear infinite;
}

.loading-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #ffffff;
}

.loading-sub {
  font-size: 15px;
  color: rgba(255,255,255,.72);
}

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

.admin-body {
  font-family: Arial, sans-serif;
  padding: 24px;
  max-width: 980px;
  margin: auto;
  background: #f3f6fb;
  color: #111827;
}

.admin-header {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  color: white;
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(0,0,0,.14);
}

.admin-title {
  margin: 0 0 6px 0;
  font-size: 28px;
  font-weight: 800;
}

.admin-subtitle {
  margin: 0;
  opacity: .82;
  font-size: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.admin-card {
  border: 1px solid #dbe3ef;
  padding: 18px;
  margin-bottom: 0;
  border-radius: 16px;
  background: white;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.admin-card h2 {
  margin: 0 0 8px 0;
  font-size: 20px;
}

.admin-desc {
  margin: 0 0 12px 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.5;
}

.admin-input,
.admin-button,
.admin-textarea {
  width: 100%;
  padding: 12px 14px;
  margin-top: 8px;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

.admin-input:focus,
.admin-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.admin-button {
  background: #111827;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

.admin-button:hover {
  background: #1f2937;
}

.admin-button.green {
  background: #15803d;
}

.admin-button.green:hover {
  background: #166534;
}

.admin-button.red {
  background: #b91c1c;
}

.admin-button.red:hover {
  background: #991b1b;
}

.status-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e3a8a;
  font-size: 13px;
  white-space: pre-wrap;
}

.list-box {
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.log {
  font-size: 13px;
  border-top: 1px solid #eef2f7;
  padding: 10px 12px;
}

.log:first-child {
  border-top: none;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e5e7eb;
  font-size: 12px;
  margin-left: 6px;
}

.error {
  color: #d32f2f;
  white-space: pre-wrap;
}

@media (max-width: 820px) {
  .topbar {
    align-items: center;
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 22px 0 12px;
  }

  .brand-chip {
    width: 62px;
    height: 62px;
    font-size: 11px;
  }

  .app-wrap {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px 14px 24px;
  }

  .side-nav {
    flex-direction: row;
    justify-content: center;
    gap: 24px;
  }

  .side-item {
    width: auto;
  }

  .side-btn {
    width: 66px;
    height: 66px;
  }

  .member-panel {
    padding: 18px;
    min-height: auto;
  }

  .profile-name {
    font-size: 32px;
  }

  .info-grid,
  .qr-grid {
    grid-template-columns: 1fr;
  }

  .info-qr-wrap,
  .qr-box {
    margin: 0 auto;
  }

  .timer-circle {
    width: 110px;
    height: 110px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 0;
  }

  .member-shell {
    min-height: 100vh;
  }

  .topbar-inner {
    align-items: center;
    gap: 10px;
  }

  .brand-group {
    gap: 10px;
  }

  .brand-chip {
    width: 54px;
    height: 54px;
    font-size: 10px;
    border-radius: 14px;
  }

  .menu-btn {
    width: 46px;
    height: 46px;
    font-size: 24px;
  }

  .profile-name {
    font-size: 28px;
  }

  .action-btn {
    padding: 16px 18px;
    font-size: 17px;
  }

  .level-card {
    padding: 22px 18px;
    border-radius: 24px;
  }

  .level-title {
    font-size: 24px;
  }

  .member-panel {
    border-radius: 16px;
  }

  .info-value-lg {
    font-size: 34px;
  }

  #member-info-qrcode,
  #member-info-qrcode img,
  #member-info-qrcode canvas {
    width: 140px !important;
    height: 140px !important;
  }

  .qr-box {
    width:240px;
    min-height: 240px;
    max-width: 100%;
  }

  #dynamic-qrcode,
  #dynamic-qrcode img,
  #dynamic-qrcode canvas {
    width: 216px !important;
    height: 216px !important;
  }

  .section-title {
    font-size: 20px;
  }

  .history-item {
    font-size: 15px;
  }

  .loading-card {
    max-width: 340px;
    padding: 30px 22px;
  }

  .loading-title {
    font-size: 20px;
  }

  .admin-body {
    padding: 14px;
  }
}

.admin-header {
  background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
  border: 1px solid rgba(255,255,255,0.05);
}

.admin-card {
  border: none;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
  transition: all .25s ease;
}

.admin-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(0,0,0,.12);
}

.admin-button.green {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.admin-button.red {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.admin-button {
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: .5px;
}
