body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Poppins', sans-serif;
  color: #f8fbff;
  background:
    radial-gradient(circle at 18% 18%, rgba(0, 229, 255, 0.15), transparent 25%),
    radial-gradient(circle at 82% 22%, rgba(255, 46, 151, 0.18), transparent 28%),
    linear-gradient(145deg, #081124 0%, #191641 44%, #271e5b 100%);
  transition: background 0.3s ease, color 0.3s ease;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 20px 32px;
  background: rgba(8, 14, 31, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo {
  font-family: 'Press Start 2P', cursive;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.logo-code {
  color: #ff9d2f;
  text-shadow: 0 0 8px rgba(255, 157, 47, 0.6);
}

.logo-recall {
  color: #ff3da2;
  text-shadow: 0 0 10px rgba(255, 61, 162, 0.62);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links a {
  color: #f8fbff;
  text-decoration: none;
  font-size: 15px;
  opacity: 0.88;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active-link {
  color: #71f0e2;
  opacity: 1;
}

.login-btn,
.primary-btn,
.secondary-btn,
.reply-btn {
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.login-btn,
.primary-btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, #ff2e97, #ff5ab6);
  color: #fff;
  box-shadow: 0 14px 28px rgba(255, 46, 151, 0.2);
}

.secondary-btn,
.reply-btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, #00d8ff, #3dffd0);
  color: #081124;
  box-shadow: 0 14px 28px rgba(0, 216, 255, 0.18);
}

.login-btn:hover,
.primary-btn:hover,
.secondary-btn:hover,
.reply-btn:hover {
  transform: translateY(-2px);
}

.nav-toggle {
  display: none;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 5px auto;
  background: #fff;
  border-radius: 999px;
}

.contact-page {
  width: min(1180px, 92%);
  margin: 0 auto;
  padding: 34px 0 72px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.fade-in {
  animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-card,
.notice-card,
.panel-card,
.tip-card {
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
}

.hero-card {
  padding: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
  gap: 22px;
}

.hero-badge,
.status-label,
.message-meta,
.tip-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.hero-badge,
.tip-index {
  color: #081124;
  background: linear-gradient(135deg, #00e5ff, #32ffc7);
}

.hero-copy h1 {
  margin: 14px 0 14px;
  font-size: clamp(34px, 5.5vw, 58px);
  line-height: 1.06;
}

.hero-copy p,
.panel-head p,
.notice-card p,
.tip-card p,
.message-body,
.message-reply {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  opacity: 0.9;
}

.hero-status-card {
  border-radius: 24px;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(255, 46, 151, 0.16), transparent 38%),
    rgba(8, 14, 31, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.status-label,
.message-meta {
  color: #7ceadb;
  background: rgba(124, 234, 219, 0.1);
}

.hero-status-card strong {
  font-size: 28px;
  line-height: 1.15;
}

.notice-card,
.panel-card,
.tip-card {
  padding: 24px;
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 22px;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.contact-form {
  display: grid;
  gap: 14px;
}

.contact-form label,
.reply-form {
  display: grid;
  gap: 6px;
}

.contact-form span,
.reply-label {
  font-size: 13px;
  font-weight: 600;
}

.contact-form input,
.contact-form textarea,
.contact-form select,
.reply-form textarea,
.search-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(8, 14, 31, 0.42);
  color: #fff;
  font: inherit;
}

.contact-form textarea,
.reply-form textarea {
  resize: vertical;
}

.form-status {
  margin: 0;
  min-height: 20px;
  color: #8df6cb;
  font-size: 13px;
}

.search-field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.search-field span {
  font-size: 13px;
  font-weight: 600;
}

.message-list,
.admin-inbox-list {
  display: grid;
  gap: 14px;
}

.message-card {
  border-radius: 22px;
  padding: 18px;
  background: rgba(8, 14, 31, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 12px;
  transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease, background 0.24s ease;
}

.reply-highlight-card {
  border-color: rgba(61, 255, 208, 0.42);
  box-shadow: 0 0 0 1px rgba(61, 255, 208, 0.15), 0 16px 36px rgba(0, 216, 255, 0.12);
}

.reply-highlight-live {
  animation: replyGlowPulse 1.15s ease-in-out 3;
}

.reply-alert-pill {
  color: #081124;
  background: linear-gradient(135deg, #00e5ff, #32ffc7);
}

.admin-ticket-card.needs-reply {
  border-color: rgba(255, 77, 166, 0.24);
  box-shadow: 0 0 0 1px rgba(255, 77, 166, 0.08), 0 16px 34px rgba(255, 77, 166, 0.08);
}

.admin-ticket-card.waiting-learner {
  border-color: rgba(50, 255, 199, 0.18);
}

.admin-ticket-state.needs-reply {
  color: #081124;
  background: linear-gradient(135deg, #ff4da6, #ff9f43);
}

.admin-ticket-state.waiting-learner {
  color: #081124;
  background: linear-gradient(135deg, #00e5ff, #32ffc7);
}

.admin-ticket-state.resolved {
  color: #081124;
  background: linear-gradient(135deg, #34d399, #10b981);
}

.admin-ticket-helper {
  margin-top: -4px;
  color: #7ceadb;
}

.learner-status-chip.waiting {
  color: #081124;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.learner-status-chip.claimed {
  color: #081124;
  background: linear-gradient(135deg, #38bdf8, #22d3ee);
}

.learner-status-chip.resolved {
  color: #081124;
  background: linear-gradient(135deg, #34d399, #10b981);
}

.message-card h3,
.message-card h4,
.tip-card h3 {
  margin: 0;
}

.message-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.ticket-id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fbff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.message-small {
  font-size: 12px;
  opacity: 0.76;
}

.message-reply-box {
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ticket-owner-note {
  font-size: 13px;
  line-height: 1.6;
  opacity: 0.82;
}

.ticket-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ticket-action-btn {
  border: none;
  border-radius: 14px;
  padding: 10px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ticket-action-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fbff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ticket-action-btn.warning {
  background: rgba(255, 159, 67, 0.18);
  color: #ffd9ad;
  border: 1px solid rgba(255, 159, 67, 0.24);
}

.ticket-action-btn.success {
  background: linear-gradient(135deg, #00d8ff, #3dffd0);
  color: #081124;
}

.ticket-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ticket-action-btn.detail {
  background: rgba(124, 234, 219, 0.12);
  color: #7ceadb;
  border: 1px solid rgba(124, 234, 219, 0.2);
}

.message-reply-title {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7ceadb;
}

.admin-inbox-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}

.ticket-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-search-field {
  flex: 1 1 280px;
  min-width: 240px;
  margin-bottom: 0;
}

.ticket-filter-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  color: #f8fbff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.ticket-filter-btn:hover,
.ticket-filter-btn.active {
  background: linear-gradient(135deg, #00e5ff, #32ffc7);
  color: #081124;
  border-color: transparent;
  transform: translateY(-1px);
}

.ticket-filter-select-wrap {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.ticket-filter-select {
  min-width: 210px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(8, 14, 31, 0.42);
  color: #f8fbff;
  font: inherit;
}

.reply-form {
  gap: 10px;
  margin-top: 4px;
}

.reply-actions {
  display: flex;
  justify-content: flex-end;
}

.empty-card {
  text-align: center;
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.tip-card {
  display: grid;
  gap: 12px;
}

.footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 14, 31, 0.7);
}

.footer-content {
  width: min(1180px, 92%);
  margin: 0 auto;
  padding: 22px 0;
  text-align: center;
}

.footer-content p {
  margin: 0;
  font-size: 14px;
  opacity: 0.86;
}

.theme-toggle {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, #7f5cff, #22d3ee, #ff4da6);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 18px 34px rgba(79, 70, 229, 0.26);
  cursor: pointer;
}

.popup {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 26, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 120;
}

.popup.active {
  display: flex;
}

.popup-box {
  width: min(460px, 100%);
  border-radius: 24px;
  background: #2c1f5f;
  padding: 22px;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.popup-box h3 {
  margin: 0 0 10px;
  font-size: 28px;
}

.ticket-detail-popup {
  z-index: 130;
}

.ticket-detail-box {
  width: min(760px, 100%);
  max-height: min(84vh, 920px);
  display: grid;
  gap: 18px;
  overflow: auto;
}

.ticket-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.ticket-detail-close {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fbff;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.ticket-detail-content {
  display: grid;
  gap: 14px;
}

.ticket-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ticket-detail-stat {
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ticket-detail-stat-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.74;
}

.ticket-detail-stat-value {
  font-size: 14px;
  line-height: 1.6;
}

.ticket-detail-section {
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 8px;
}

.ticket-detail-section h4 {
  margin: 0;
  font-size: 15px;
}

.ticket-detail-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  opacity: 0.92;
  white-space: pre-wrap;
}

.reply-history-list {
  display: grid;
  gap: 12px;
}

.conversation-thread {
  display: grid;
  gap: 12px;
}

.conversation-entry {
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 8px;
}

.conversation-entry.admin {
  background: rgba(124, 234, 219, 0.08);
  border-color: rgba(124, 234, 219, 0.18);
}

.conversation-entry.learner {
  background: rgba(255, 255, 255, 0.04);
}

.conversation-entry.latest {
  box-shadow: 0 0 0 1px rgba(124, 234, 219, 0.08);
}

.conversation-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.reply-history-item {
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 8px;
}

.reply-history-item.latest {
  border-color: rgba(124, 234, 219, 0.24);
}

.popup-box p {
  margin: 0;
  opacity: 0.9;
  line-height: 1.7;
  font-size: 15px;
}

.popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

@keyframes replyGlowPulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 0 0 1px rgba(61, 255, 208, 0.15), 0 16px 36px rgba(0, 216, 255, 0.12);
  }
  50% {
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(61, 255, 208, 0.32), 0 20px 44px rgba(0, 216, 255, 0.22);
  }
}

body.light-mode {
  color: #111827;
  background:
    radial-gradient(circle at 20% 16%, rgba(34, 211, 238, 0.18), transparent 26%),
    radial-gradient(circle at 82% 18%, rgba(255, 77, 166, 0.14), transparent 28%),
    linear-gradient(160deg, #edf4ff 0%, #f8fbff 46%, #eef3ff 100%);
}

body.light-mode .navbar {
  background: rgba(255, 255, 255, 0.82);
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .nav-links a {
  color: #111827;
}

body.light-mode .nav-links a:hover,
body.light-mode .nav-links a.active-link {
  color: #0f766e;
}

body.light-mode .hero-card,
body.light-mode .notice-card,
body.light-mode .panel-card,
body.light-mode .tip-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .hero-status-card,
body.light-mode .message-card,
body.light-mode .message-reply-box,
body.light-mode .contact-form input,
body.light-mode .contact-form textarea,
body.light-mode .contact-form select,
body.light-mode .reply-form textarea,
body.light-mode .search-field input {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.08);
  color: #111827;
}

body.light-mode .status-label,
body.light-mode .message-meta,
body.light-mode .message-reply-title {
  color: #0f766e;
}

body.light-mode .ticket-id {
  background: rgba(15, 23, 42, 0.06);
  color: #1e1547;
}

body.light-mode .footer {
  background: rgba(255, 255, 255, 0.78);
  border-top-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .popup-box {
  background: rgba(255,255,255,0.95);
  color: #1e1547;
}

body.light-mode .ticket-action-btn.detail {
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.14);
}

body.light-mode .ticket-detail-close {
  background: rgba(15, 23, 42, 0.05);
  color: #1e1547;
}

body.light-mode .ticket-detail-stat,
body.light-mode .ticket-detail-section {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .reply-history-item {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .conversation-entry.learner {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .conversation-entry.admin {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.14);
}

body.light-mode .ticket-filter-btn {
  background: rgba(15, 23, 42, 0.05);
  color: #111827;
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .ticket-filter-btn:hover,
body.light-mode .ticket-filter-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #0f766e, #22c55e);
}

body.light-mode .ticket-filter-select {
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .ticket-action-btn.secondary {
  background: rgba(15, 23, 42, 0.05);
  color: #111827;
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .ticket-action-btn.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.18);
}

body.light-mode .reply-highlight-card {
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.08), 0 16px 32px rgba(15, 23, 42, 0.08);
}

body.light-mode .reply-alert-pill {
  color: #ffffff;
  background: linear-gradient(135deg, #0f766e, #22c55e);
}

body.light-mode .admin-ticket-card.needs-reply {
  border-color: rgba(190, 24, 93, 0.2);
  box-shadow: 0 0 0 1px rgba(190, 24, 93, 0.06), 0 16px 32px rgba(15, 23, 42, 0.08);
}

body.light-mode .admin-ticket-state.needs-reply,
body.light-mode .admin-ticket-state.waiting-learner,
body.light-mode .admin-ticket-state.resolved {
  color: #ffffff;
}

body.light-mode .admin-ticket-helper {
  color: #0f766e;
}

body.light-mode .learner-status-chip.waiting,
body.light-mode .learner-status-chip.claimed,
body.light-mode .learner-status-chip.resolved {
  color: #ffffff;
}

@media (max-width: 980px) {
  .hero-card,
  .workspace-grid,
  .tips-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .navbar {
    padding: 18px 18px;
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: inline-block;
  }

  .nav-links {
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding-top: 8px;
  }

  .navbar.mobile-nav-open .nav-links,
  .navbar.mobile-open .nav-links {
    display: flex;
  }

  .contact-page {
    width: min(94%, 94%);
    padding-top: 22px;
  }

  .hero-card,
  .notice-card,
  .panel-card,
  .tip-card {
    padding: 20px;
    border-radius: 24px;
  }

  .message-top,
  .notice-actions,
  .ticket-action-row,
  .admin-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-search-field {
    min-width: 100%;
  }

  .ticket-filter-select {
    min-width: 100%;
  }

  .logo {
    font-size: 13px;
  }

  .theme-toggle {
    width: 54px;
    height: 54px;
    right: 16px;
    bottom: 16px;
  }

  .popup-box {
    padding: 20px;
  }

  .ticket-detail-grid {
    grid-template-columns: 1fr;
  }
}
