/* Euro Rater 2026 — Eurovision vibes, geocities forever */

:root {
  --purple: #7B2FBE;
  --dark-purple: #4B0082;
  --gold: #FFD700;
  --hot-pink: #FF1493;
  --cyan: #00FFFF;
  --bg: #0D0D2B;
  --text: #FFFFFF;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  background: linear-gradient(160deg, #0D0D2B 0%, #2a0060 50%, #0D0D2B 100%);
  color: var(--text);
  font-family: 'Arial Black', Arial, sans-serif;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  background: rgba(11, 11, 40, 0.97);
  border-left: 3px solid var(--gold);
  border-right: 3px solid var(--gold);
  display: flex;
  flex-direction: column;
}

/* ---- Install Banner ---- */

#install-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(90deg, #0a0a2e, #2a006a);
  border-bottom: 2px solid var(--cyan);
  font-size: 0.8rem;
  flex-shrink: 0;
}

#install-banner span {
  flex: 1;
  color: var(--cyan);
}

#install-accept {
  background: var(--cyan);
  color: #000;
  border: none;
  padding: 5px 10px;
  font-weight: bold;
  font-size: 0.75rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}

#install-dismiss {
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 5px 8px;
  font-size: 0.75rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}

/* ---- Fullscreen overlay ---- */

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--bg);
  border: 3px solid var(--gold);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  max-width: 280px;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
}

.modal h2 {
  color: var(--gold);
  font-size: 1.4rem;
  margin-bottom: 10px;
  text-shadow: 0 0 12px var(--gold);
}

.modal p {
  color: var(--cyan);
  margin-bottom: 24px;
  font-size: 0.9rem;
  font-family: Arial, sans-serif;
  font-weight: normal;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ---- Screens ---- */

section {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

section.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

/* ---- Header ---- */

.app-header {
  background: linear-gradient(90deg, #2a0060, var(--hot-pink), #2a0060);
  padding: 12px 16px;
  text-align: center;
  border-bottom: 3px solid var(--gold);
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 1.3rem;
  color: var(--gold);
  text-shadow: 0 0 10px var(--hot-pink), 0 0 24px var(--hot-pink);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.list-header {
  position: relative;
}

.btn-settings {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gold);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px 8px;
  line-height: 1;
  font-family: inherit;
  opacity: 0.75;
}

.btn-settings:hover, .btn-settings:active { opacity: 1; }

/* ---- Settings screen ---- */

.settings-header {
  display: flex;
  align-items: center;
  text-align: left;
}

.settings-header h1 {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
}

.settings-back { font-size: 1.2rem; }

.settings-header-spacer { width: 40px; flex-shrink: 0; }

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-field label {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.settings-field input[type="text"] {
  background: rgba(123, 47, 190, 0.25);
  border: 2px solid var(--purple);
  color: var(--text);
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  border-radius: 4px;
  width: 100%;
}

.settings-field input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.settings-field input[type="text"]::placeholder { color: rgba(255,255,255,0.3); }

.settings-field-row {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.settings-field-row label { flex: 1; }

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-off          { background: rgba(255,255,255,0.25); }
.status-connected    { background: #00e676; box-shadow: 0 0 6px #00e676; }
.status-disconnected { background: var(--hot-pink); box-shadow: 0 0 6px var(--hot-pink); }

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

.settings-divider {
  height: 1px;
  background: rgba(123, 47, 190, 0.4);
}

.btn-secondary-action {
  background: transparent;
  color: var(--text);
  border: 2px solid rgba(255,255,255,0.3);
  padding: 9px 16px;
  font-size: 0.85rem;
  font-family: inherit;
  border-radius: 4px;
  cursor: pointer;
}

.btn-secondary-action:hover, .btn-secondary-action:active {
  background: rgba(255,255,255,0.08);
}

.btn-danger {
  color: var(--hot-pink);
  border-color: rgba(255, 20, 147, 0.4);
}

.btn-danger:hover, .btn-danger:active {
  background: rgba(255, 20, 147, 0.12) !important;
}

/* ---- List screen ---- */

.list-controls {
  padding: 10px 16px;
  background: rgba(123, 47, 190, 0.25);
  border-bottom: 2px solid rgba(123, 47, 190, 0.5);
  flex-shrink: 0;
}

#country-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.country-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(123, 47, 190, 0.35);
  background: rgba(75, 0, 130, 0.15);
  user-select: none;
}

.country-row.is-dragging {
  opacity: 0.35;
  background: rgba(255, 215, 0, 0.08);
  border: 1px dashed var(--gold);
}

.drag-handle {
  cursor: grab;
  font-size: 1.2rem;
  color: var(--gold);
  padding: 4px 2px;
  flex-shrink: 0;
  touch-action: none;
  line-height: 1;
}

.drag-handle:active {
  cursor: grabbing;
}

.country-info {
  flex: 1;
  min-width: 0;
}

.country-info strong {
  display: block;
  color: var(--gold);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-info span {
  display: block;
  color: var(--cyan);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  font-family: Arial, sans-serif;
  font-weight: normal;
}

.emoji-zone {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.emoji-chip {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 2px 3px;
  line-height: 1;
  border-radius: 4px;
  font-family: inherit;
}

.emoji-chip:hover, .emoji-chip:active {
  background: rgba(255, 255, 255, 0.15);
}


/* ---- Buttons ---- */

.btn-primary {
  background: linear-gradient(90deg, var(--hot-pink), var(--purple));
  color: #fff;
  border: none;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: bold;
  font-family: inherit;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(255, 20, 147, 0.5);
}

.btn-primary:hover, .btn-primary:active {
  opacity: 0.85;
}

.btn-save {
  background: linear-gradient(90deg, var(--gold), #e69900);
  color: #000;
  border: none;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: bold;
  font-family: inherit;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-save:hover, .btn-save:active {
  opacity: 0.85;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 2px solid rgba(255, 255, 255, 0.35);
  padding: 10px 18px;
  font-size: 0.95rem;
  font-family: inherit;
  border-radius: 4px;
  cursor: pointer;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
  line-height: 1;
}

/* ---- Emoji picker dialog ---- */

#emoji-picker-dialog {
  max-width: min(92vw, 420px);
  max-height: 75vh;
}

#emoji-picker-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.emoji-picker-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.emoji-picker-favorites {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 8px 10px;
  border-bottom: 2px solid var(--gold);
  background: linear-gradient(90deg, #2a0060, var(--hot-pink), #2a0060);
  flex-shrink: 0;
  min-height: 48px;
}

.emoji-picker-used {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.emoji-picker-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 10px 12px 14px;
}

.emoji-picker-category {
  grid-column: 1 / -1;
  color: var(--gold);
  font-size: 0.65rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 2px 2px;
  opacity: 0.7;
  font-family: Arial, sans-serif;
}

.emoji-picker-category:first-child {
  padding-top: 2px;
}

.emoji-picker-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 1.45rem;
  line-height: 1;
  padding: 5px 2px;
  cursor: pointer;
  text-align: center;
  transition: background 0.1s, border-color 0.1s;
  font-family: inherit;
}

.emoji-picker-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.emoji-picker-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.emoji-picker-btn.selected {
  background: rgba(255, 215, 0, 0.2);
  border-color: var(--gold);
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.emoji-picker-btn.dimmed {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---- Dialog ---- */

dialog {
  background: var(--bg);
  border: 3px solid var(--gold);
  border-radius: 8px;
  color: var(--text);
  max-width: min(90vw, 420px);
  width: 100%;
  max-height: 80vh;
  padding: 0;
  box-shadow: 0 0 50px rgba(75, 0, 130, 0.8);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 2px solid var(--gold);
  background: linear-gradient(90deg, #2a0060, var(--hot-pink), #2a0060);
  flex-shrink: 0;
}

.dialog-header h2 {
  color: var(--gold);
  font-size: 1rem;
}

#dialog-country-list {
  list-style: none;
  padding: 8px 0;
  overflow-y: auto;
  max-height: calc(80vh - 60px);
}

#dialog-country-list li {
  padding: 3px 12px;
}

.dialog-country-btn {
  width: 100%;
  background: rgba(123, 47, 190, 0.2);
  border: 1px solid rgba(123, 47, 190, 0.5);
  color: var(--text);
  padding: 8px 14px;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialog-country-btn:hover, .dialog-country-btn:active {
  background: rgba(123, 47, 190, 0.55);
  color: var(--gold);
}

/* ---- Flag images ---- */

.country-flag {
  display: block;
  flex-shrink: 0;
  clip-path: circle(calc(50% - 2px));
}


/* ---- Scrollbars ---- */

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: rgba(75, 0, 130, 0.15); }
::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 3px; }
