:root {
  --bg-dark: #0f0f12;
  --bg-card: #1a1a22;
  --bg-card-hover: #22222c;
  --border: #2a2a36;
  --text: #e8e8f0;
  --text-muted: #9a9ab0;
  --accent: #5b8def;
  --accent-hover: #7aa3f5;
  --accent-green: #3ecf8e;
  --accent-orange: #f0a050;
  --accent-red: #ef5b5b;
  --pixel: #c8d0ff;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
}

/* Subtle Minecraft-like grid texture */
.bg-overlay {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(20, 20, 28, 0.92), rgba(15, 15, 20, 0.95)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(255, 255, 255, 0.015) 31px,
      rgba(255, 255, 255, 0.015) 32px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 31px,
      rgba(255, 255, 255, 0.015) 31px,
      rgba(255, 255, 255, 0.015) 32px
    );
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(15, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #5b8def, #3a6fd8);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  color: white;
  box-shadow: 0 0 16px rgba(91, 141, 239, 0.4);
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.brand-name span {
  color: var(--accent);
}

.top-actions {
  display: flex;
  gap: 10px;
}

.btn-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-profile:hover {
  background: var(--bg-card-hover);
  border-color: #3a3a4a;
}

.avatar {
  font-size: 1rem;
}

/* Views */
.view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view.active {
  display: block;
}

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

/* Hero */
.hero {
  text-align: center;
  padding: 48px 0 36px;
}

.pixel-title {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.1rem, 3.5vw, 1.65rem);
  color: var(--pixel);
  text-shadow: 0 0 24px rgba(200, 208, 255, 0.25);
  margin-bottom: 16px;
  line-height: 1.4;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto 28px;
}

.search-wrap {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
}

.search-wrap input {
  width: 100%;
  padding: 14px 18px 14px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.2);
}

.search-wrap input::placeholder {
  color: #6a6a80;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
  pointer-events: none;
}

/* Section header */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.section-header .hint {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.section-title {
  font-size: 1.35rem;
  margin-bottom: 20px;
}

/* Category cards */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
}

.cat-card:hover {
  background: var(--bg-card-hover);
  border-color: #3a3a4a;
  transform: translateY(-2px);
}

.cat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  background: rgba(91, 141, 239, 0.15);
}

.cat-card h3 {
  font-size: 1rem;
  font-weight: 600;
}

.cat-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  flex: 1;
}

.cat-card .start {
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 4px;
}

.cat-card:hover .start {
  color: var(--accent-hover);
}

/* Form */
.back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  margin-bottom: 20px;
  padding: 4px 0;
  transition: color 0.15s;
}

.back-btn:hover {
  color: var(--text);
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 560px;
  box-shadow: var(--shadow);
}

.form-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.cat-icon-lg {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  background: rgba(91, 141, 239, 0.15);
  flex-shrink: 0;
}

.form-header h2 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.form-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: #121218;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: 8px;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Tickets list */
.tickets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.ticket-item:hover {
  background: var(--bg-card-hover);
  border-color: #3a3a4a;
}

.ticket-meta h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.ticket-meta .sub {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge.open { background: rgba(62, 207, 142, 0.15); color: var(--accent-green); }
.badge.pending { background: rgba(240, 160, 80, 0.15); color: var(--accent-orange); }
.badge.closed { background: rgba(154, 154, 176, 0.15); color: var(--text-muted); }
.badge.urgent { background: rgba(239, 91, 91, 0.15); color: var(--accent-red); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 20px;
}

/* Detail */
.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
  box-shadow: var(--shadow);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.detail-header h2 {
  font-size: 1.25rem;
  margin-bottom: 6px;
}

.detail-body {
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 20px;
}

.detail-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.detail-info strong {
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-green);
  color: #0a1a12;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(62, 207, 142, 0.35);
  z-index: 100;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 600px) {
  .topbar {
    padding: 12px 16px;
  }

  .brand-name {
    font-size: 1rem;
  }

  .hero {
    padding: 32px 0 24px;
  }

  .form-card,
  .detail-card {
    padding: 20px;
  }

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

  .ticket-item {
    flex-direction: column;
    align-items: flex-start;
  }
}
