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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-light: #0f3460;
  --accent: #e94560;
  --text: #eee;
  --text-muted: #999;
  --success: #2ecc71;
  --radius: 12px;
  --max-width: 480px;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* Screens */
.screen {
  display: none;
  min-height: 100vh;
  padding: 0 16px 32px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.screen.active {
  display: block;
}

/* Header */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

h1 {
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--accent);
}


h2 {
  font-size: 20px;
  flex: 1;
}

.points-display {
  background: var(--surface);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  line-height: 1;
}

.back-btn:active {
  background: var(--surface);
}

/* Level Select */
.level-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.level-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-card:active {
  transform: scale(0.98);
}

.level-card.locked {
  opacity: 0.45;
  cursor: default;
}

.level-card.locked:active {
  transform: none;
}

.level-card-info h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.level-card-info .level-progress {
  font-size: 13px;
  color: var(--text-muted);
}

.level-card-status {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
}

.level-card-status .lock-label {
  color: var(--accent);
  font-weight: 600;
}

/* Logo Grid */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.logo-cell {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--surface);
  transition: transform 0.1s;
}

.logo-cell:active {
  transform: scale(0.95);
}

.logo-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.logo-cell .check-overlay {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Guess Screen */
.guess-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.logo-large-container {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.logo-large {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.guess-input-area {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}

.guess-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--surface-light);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

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

.btn-guess {
  padding: 12px 20px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-guess:active {
  opacity: 0.85;
}

.guess-feedback {
  font-size: 14px;
  color: var(--accent);
  min-height: 20px;
  text-align: center;
}

.guess-success {
  text-align: center;
  width: 100%;
}

.guess-success .success-message {
  font-size: 22px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 4px;
}

.guess-success .success-name {
  font-size: 18px;
  color: var(--text);
}

/* Map */
.guess-map {
  width: 100%;
  max-width: 320px;
  margin: 16px auto 0;
}

#guess-map-view {
  width: 100%;
  height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
}

.map-addresses {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-address-item {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0;
}

.hidden {
  display: none !important;
}

/* Screen transitions */
.screen {
  animation: fadeIn 0.15s ease-out;
}

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