:root {
  --bg: #15111f;
  --card: rgba(255, 255, 255, 0.09);
  --card-strong: rgba(255, 255, 255, 0.14);
  --text: #fffaf0;
  --muted: #cabfd8;
  --primary: #ffb84c;
  --primary-dark: #e39420;
  --accent: #8ce6d0;
  --danger: #ff6b6b;
  --success: #7ee787;
  --border: rgba(255, 255, 255, 0.18);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0 0 calc(24px + env(safe-area-inset-bottom));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 184, 76, 0.25), transparent 32%),
    radial-gradient(circle at bottom right, rgba(140, 230, 208, 0.2), transparent 35%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#app {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 16px 14px 28px;
}

.screen {
  animation: rise 0.28s ease;
}

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

.hero {
  padding: 24px 8px 18px;
  text-align: center;
  position: relative;
}

.hero-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 8px;
  position: relative;
}

.settings-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.settings-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  padding: 10px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: 220px;
  gap: 8px;
}

.settings-menu.open {
  display: grid;
}

.logo {
  width: 92px;
  height: 92px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--primary), #ff7a90);
  color: #241420;
  font-size: 44px;
  box-shadow: var(--shadow);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(42px, 12vw, 68px);
  line-height: 0.92;
  letter-spacing: -2px;
  margin-bottom: 12px;
}

h2 {
  font-size: 30px;
  margin-bottom: 10px;
}

.subtitle,
.muted {
  color: var(--muted);
  line-height: 1.55;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  margin-bottom: 16px;
}

.card.soft {
  box-shadow: none;
  background: var(--card-strong);
}

.actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row.between {
  justify-content: space-between;
}

.row.wrap {
  flex-wrap: wrap;
}

.btn {
  width: 100%;
  min-height: 56px;
  border-radius: 18px;
  padding: 14px 16px;
  background: var(--card-strong);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.18);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), #ff7a90);
  color: #25151e;
  border: 0;
}

.btn.accent {
  background: linear-gradient(135deg, var(--accent), #9fbbff);
  color: #102520;
  border: 0;
}

.btn.danger {
  background: rgba(255, 107, 107, 0.15);
  color: #ffd2d2;
  border-color: rgba(255, 107, 107, 0.4);
}

.btn.small {
  width: auto;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
}

.btn.ghost {
  background: transparent;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 52px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  font-size: 16px;
}

.select option {
  color: #111;
}

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

.label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.field {
  margin-bottom: 14px;
}

.pill-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.pill {
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}

.pill.active {
  background: var(--primary);
  color: #21141d;
  border-color: transparent;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
}

.player-name {
  font-weight: 900;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.progress {
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
}

.secret-box {
  text-align: center;
  min-height: 260px;
  display: grid;
  place-items: center;
}

.secret-word {
  font-size: clamp(42px, 12vw, 72px);
  font-weight: 950;
  letter-spacing: -1px;
  color: var(--primary);
  word-break: break-word;
}

.incognito-box {
  border: 1px dashed rgba(255, 184, 76, 0.6);
  background: rgba(255, 184, 76, 0.1);
}

.notice {
  border-radius: 18px;
  padding: 12px 14px;
  margin: 12px 0;
  line-height: 1.45;
  color: #fff3d7;
  background: rgba(255, 184, 76, 0.12);
  border: 1px solid rgba(255, 184, 76, 0.35);
}

.error {
  color: #ffd6d6;
  background: rgba(255, 107, 107, 0.13);
  border-color: rgba(255, 107, 107, 0.38);
}

.success {
  color: #ddffe5;
  background: rgba(126, 231, 135, 0.13);
  border-color: rgba(126, 231, 135, 0.38);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.vote-grid {
  display: grid;
  gap: 10px;
}

.result-title {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 8px;
}

.score-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px;
  padding: 9px 11px;
  border-radius: 999px;
  background: rgba(140, 230, 208, 0.12);
  border: 1px solid rgba(140, 230, 208, 0.3);
}

.word-chip button {
  background: transparent;
  color: var(--danger);
  font-weight: 900;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 18px;
}

@media (max-width: 480px) {
  #app { padding: 10px 10px 24px; }
  .hero { padding-top: 10px; }
  .card { padding: 16px; border-radius: 20px; }
  .btn { min-height: 58px; }
  .btn.small { min-height: 46px; }
  .topbar { flex-wrap: wrap; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
