@font-face {
  font-family: "Vazir";
  src: url("../fonts/Vazir-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazir";
  src: url("../fonts/Vazir-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0f172a;
  --card: #111827;
  --card-2: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #22c55e;
  --primary-hover: #16a34a;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --border: #374151;
  --accent: #fbbf24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Vazir, Tahoma, sans-serif;
  background: radial-gradient(circle at top, #1e293b, var(--bg));
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.app {
  width: min(760px, 100%);
  background: linear-gradient(160deg, var(--card), #0b1220);
  border: 1px solid #263244;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.app.wide {
  width: min(900px, 100%);
}

h1 {
  margin: 0 0 18px;
  font-size: 1.6rem;
}

h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: -8px 0 14px;
  text-align: right;
  font-weight: 400;
}

.nav-home {
  display: inline-block;
  margin-bottom: 12px;
  color: #86efac;
  text-decoration: none;
  font-size: 0.95rem;
}
.nav-home:hover {
  text-decoration: underline;
}

.site-footer {
  margin-top: 24px;
  padding: 12px 14px;
  border: 1px solid #2b3648;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.5);
  color: #94a3b8;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.65;
}

.site-footer p {
  margin: 2px 0;
}

.site-footer a {
  color: #a7f3d0;
  text-decoration: none;
  font-weight: 600;
}

.site-footer a:hover {
  color: #d1fae5;
  text-decoration: underline;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 16px;
}

.row-single {
  display: block;
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #4b5563;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.7;
}

input[type="number"] {
  max-width: 160px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  color: white;
  cursor: pointer;
  transition: 0.2s;
}

.add-btn,
.draw-btn,
.primary-btn {
  background: var(--primary);
}
.add-btn:hover,
.draw-btn:hover,
.primary-btn:hover {
  background: var(--primary-hover);
}

.neutral-btn {
  background: #4b5563;
}

.neutral-btn:hover {
  background: #374151;
}

.secondary-btn {
  background: #4b5563;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: 0.2s;
}

.secondary-btn:hover {
  background: #374151;
}

.neutral-btn:disabled {
  background: #374151;
  opacity: 0.55;
  cursor: not-allowed;
}

.draw-btn:disabled,
.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.card {
  border: 1px solid var(--border);
  background: rgba(31, 41, 55, 0.5);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  transition: 0.35s ease;
}

.status {
  color: #93c5fd;
  font-size: 0.85rem;
  margin: 2px 0 14px;
  min-height: 20px;
}

/* Hub */
.hub-intro {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 18px;
}

.hub-search {
  margin-bottom: 18px;
}

.hub-search-wrap {
  position: relative;
}

.hub-search-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--muted);
  pointer-events: none;
}

.hub-search-input {
  width: 100%;
  padding-inline-start: 44px;
  padding-inline-end: 14px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  border-radius: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
  font: inherit;
  outline: none;
}

.hub-search-input:focus {
  border-color: #4b5563;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.hub-search-input::placeholder {
  color: #6b7280;
}

.hub-search-empty {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: #fca5a5;
  min-height: 1.4em;
}

.recent-tools {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid rgba(134, 239, 172, 0.25);
  border-radius: 16px;
  background: rgba(34, 197, 94, 0.08);
}

.recent-tools[hidden] {
  display: none;
}

.recent-tools-head {
  margin-bottom: 12px;
}

.recent-tools-head h2 {
  margin: 0 0 4px;
  color: #e5e7eb;
  font-size: 1.05rem;
  font-weight: 700;
}

.recent-tools-head span {
  color: var(--muted);
  font-size: 0.88rem;
}

.recent-tools-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}

.recent-tool-item {
  position: relative;
}

.recent-tool-item > a {
  padding-left: 52px;
}

.recent-tool-remove {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.recent-tool-remove:hover {
  background: rgba(239, 68, 68, 0.28);
}

.recent-tool-remove svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tool-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  align-items: stretch;
}

.tool-grid > li {
  display: flex;
  min-width: 0;
}

.tool-grid > li.tool-grid-item--full {
  grid-column: 1 / -1;
}

.tool-grid > li.tool-grid-item--hidden {
  display: none !important;
}

.tool-grid > li > a {
  flex: 1;
  min-width: 0;
}

.tool-grid a {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(31, 41, 55, 0.45);
  color: var(--text);
  text-decoration: none;
  transition: 0.2s border-color, 0.2s background;
  height: 100%;
}
.tool-grid a:hover {
  border-color: #4b5563;
  background: rgba(55, 65, 81, 0.35);
}

.tool-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #86efac;
}
.tool-grid a:hover .tool-card-icon {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.35);
}
.tool-card-icon svg {
  width: 26px;
  height: 26px;
}

.tool-card-text {
  flex: 1;
  min-width: 0;
}

.tool-grid strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
  color: #f3f4f6;
}

.tool-card-desc {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

/* Lottery */
#namesList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}
#namesList li {
  background: #0f172a;
  border: 1px solid #2b3648;
  border-radius: 10px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.list-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.remove-name-btn {
  background: #374151;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: white;
  border: 0;
  cursor: pointer;
}
.remove-name-btn:hover {
  background: #4b5563;
}

.result-box {
  text-align: center;
  padding: 16px;
  transition: 0.35s ease;
}
.collapsed {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  border-width: 0;
  pointer-events: none;
  transform: translateY(-8px);
}
.result-box.focus-mode {
  transform: scale(1.02);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.28), 0 16px 30px rgba(0, 0, 0, 0.3);
}
#resultName {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
  min-height: 94px;
  margin: 10px 0 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fef3c7;
  background: linear-gradient(135deg, #1f2937, #374151);
  border: 1px solid #4b5563;
  border-radius: 16px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 20px rgba(0, 0, 0, 0.25);
}
.rolling {
  animation: pulse 0.35s infinite;
  color: #fde68a;
  background: linear-gradient(135deg, #3f2f0a, #5b4010);
  border-color: #a16207;
}
@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
}
.delete-btn {
  background: var(--danger);
  display: none;
  margin: 0 auto;
}
.delete-btn:hover {
  background: var(--danger-hover);
}

.seo-content {
  margin-top: 14px;
  border-top: 1px solid #2b3648;
  padding-top: 14px;
  color: #cbd5e1;
  line-height: 2;
  font-size: 0.95rem;
}
.seo-content h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: #e5e7eb;
}
.seo-content a {
  color: #86efac;
  text-decoration: none;
}
.seo-content a:hover {
  text-decoration: underline;
}

/* Random number */
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 14px;
}
.field-row > div {
  flex: 1;
  min-width: 120px;
}
.output-numbers {
  font-size: 1.15rem;
  line-height: 1.8;
  word-break: break-all;
  min-height: 2em;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.checkbox-row input {
  width: auto;
}

/* Coin */
.coin-stage {
  perspective: 800px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 160px;
  margin: 16px 0;
}
.coin {
  width: 140px;
  height: 140px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 2s cubic-bezier(0.25, 0.1, 0.25, 1);
  transform: rotateY(0deg);
}
.coin-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  border: 4px solid #ca8a04;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.35);
}
.coin-face.heads {
  background: linear-gradient(145deg, #eab308, #ca8a04);
  color: #422006;
}
.coin-face.tails {
  background: linear-gradient(145deg, #94a3b8, #64748b);
  color: #0f172a;
  transform: rotateY(180deg);
}
.coin-result {
  text-align: center;
  font-size: 1.25rem;
  margin-top: 8px;
}

/* Dice */
.dice-count-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.dice-count-row label {
  width: 100%;
  text-align: center;
  margin-bottom: 0;
}

.dice-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
}

.dice-stepper button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  background: #374151;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
}

.dice-stepper button:hover:not(:disabled) {
  background: #4b5563;
}

.dice-stepper button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dice-stepper input[type="number"] {
  width: 52px;
  max-width: none;
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  -moz-appearance: textfield;
}

.dice-stepper input[type="number"]::-webkit-outer-spin-button,
.dice-stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.dice-wrap {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.dice-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  min-height: 124px;
}

.dice-tray.dice-tray--compact .dice {
  width: 88px;
  height: 88px;
  padding: 10px;
  gap: 3px;
  border-radius: 14px;
}

.dice-tray.dice-tray--compact .dice .pip {
  width: 14px;
  height: 14px;
}

.dice {
  width: 120px;
  height: 120px;
  background: linear-gradient(145deg, #f8fafc, #e2e8f0);
  border-radius: 18px;
  border: 2px solid #94a3b8;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 14px;
  gap: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  transition: transform 0.35s ease-out;
}
.dice.pip {
  place-items: center;
}
.dice .pip-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}
.dice .pip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1e293b;
  opacity: 0;
}
.dice .pip.on {
  opacity: 1;
}
.dice-result {
  text-align: center;
  font-size: 1.2rem;
}

/* Shuffle / teams */
.result-columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.team-col {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #0f172a;
}
.team-col h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--accent);
}
.team-col ul {
  margin: 0;
  padding: 0 18px 0 0;
  line-height: 1.7;
}

.shuffled-list {
  margin: 0;
  padding: 0 20px 0 0;
  line-height: 1.9;
}

/* Roulette */
.roulette-layout {
  display: grid;
  gap: 16px;
}
@media (min-width: 640px) {
  .roulette-layout {
    grid-template-columns: 1fr 320px;
    align-items: start;
  }
}
#rouletteCanvas {
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4));
}
.roulette-pointer {
  text-align: center;
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.roulette-opt-count {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
  margin-inline-start: 6px;
}

.roulette-limit-promo {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
  font-size: 0.85rem;
  line-height: 1.75;
}

.roulette-limit-promo a {
  color: #fbbf24;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.roulette-limit-promo a:hover {
  color: #fcd34d;
}

/* Timers & Pomodoro */
.timer-display {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.06em;
  color: #fef3c7;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
  margin: 16px 0;
  font-feature-settings: "tnum" 1;
}

.timer-display.timer-done {
  color: #86efac;
  animation: timerPulse 0.6s ease 2;
}

@keyframes timerPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

.timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.timer-presets button {
  background: #374151;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
}

.timer-presets button:hover {
  background: #4b5563;
}

.timer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.timer-controls button.secondary-btn {
  background: #374151;
}

.timer-controls button.secondary-btn:hover {
  background: #4b5563;
}

.phase-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  margin-bottom: 8px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.phase-badge.break {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}

.phase-badge.long {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.35);
  color: #d8b4fe;
}

.lap-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 180px;
  overflow: auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  color: var(--muted);
}

.lap-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #2b3648;
}

/* Hourglass visual */
.hourglass-scene {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  position: relative;
  min-height: 220px;
}

.hourglass-ring-svg {
  width: min(240px, 80vw);
  height: auto;
  transform: rotate(-90deg);
}

.hourglass-ring-svg .hg-track {
  fill: none;
  stroke: #374151;
  stroke-width: 8;
}

.hourglass-ring-svg .hg-bar {
  fill: none;
  stroke: url(#hgGrad);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear;
}

.hourglass-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 4.5rem;
  line-height: 1;
  user-select: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

/* Truth or Dare */
.tod-actions {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 520px) {
  .tod-actions {
    grid-template-columns: 1fr 1fr;
  }
}

.tod-actions button.tod-btn {
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font: inherit;
  cursor: pointer;
  color: white;
  font-weight: 600;
}

.tod-btn.truth {
  background: linear-gradient(145deg, #2563eb, #1d4ed8);
}

.tod-btn.truth:hover {
  filter: brightness(1.08);
}

.tod-btn.dare {
  background: linear-gradient(145deg, #c026d3, #86198f);
}

.tod-btn.dare:hover {
  filter: brightness(1.08);
}

.tod-btn.random {
  background: linear-gradient(145deg, #059669, var(--primary-hover));
  grid-column: 1 / -1;
}

.tod-result {
  margin-top: 18px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  min-height: 5rem;
  line-height: 1.85;
  font-size: 1.05rem;
}

.tod-result-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.tod-manager-grid {
  display: grid;
  gap: 14px;
}

@media (min-width: 720px) {
  .tod-manager-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tod-manager-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.45);
}

.tod-manager-panel h3 {
  margin: 0 0 10px;
  color: #f3f4f6;
  font-size: 1rem;
}

.tod-manager-panel textarea {
  min-height: 100px;
}

.tod-manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.tod-manager-actions .secondary-btn {
  background: #374151;
}

.tod-manager-actions .secondary-btn:hover {
  background: #4b5563;
}

.tod-manager-actions .danger-btn {
  background: var(--danger);
}

.tod-manager-actions .danger-btn:hover {
  background: var(--danger-hover);
}

.tod-manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.tod-manage-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #2b3648;
  border-radius: 10px;
  background: rgba(31, 41, 55, 0.55);
  line-height: 1.7;
}

.tod-manage-list li span {
  flex: 1;
}

.tod-manage-list button {
  flex-shrink: 0;
  background: var(--danger);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.tod-manage-list button:hover {
  background: var(--danger-hover);
}

.tod-manage-list .tod-manage-empty {
  color: var(--muted);
  justify-content: center;
}

/* Mafia role assignment */
.mafia-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .mafia-setup-grid {
    grid-template-columns: 1fr;
  }
}

.mafia-setup-grid label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.mafia-setup-grid textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
}

.mafia-counts {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.mafia-reveal-stage {
  text-align: center;
  padding: 18px 14px 20px;
}

.mafia-ready-stage .mafia-reveal-guide {
  margin-bottom: 14px;
}

.mafia-role-card--ready {
  border-color: #4b5563;
  background: linear-gradient(165deg, #1f2937 0%, #111827 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 14px 32px rgba(0, 0, 0, 0.35);
}

.mafia-ready-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fef9c3;
}

.mafia-ready-text {
  margin: 10px 0 0;
  font-size: 1rem;
  line-height: 1.7;
  color: #cbd5e1;
  max-width: 280px;
}

.mafia-reveal-guide {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: #fcd34d;
  line-height: 1.6;
}

.mafia-role-card {
  position: relative;
  max-width: 340px;
  margin: 0 auto 18px;
  padding: 28px 20px 24px;
  border-radius: 20px;
  border: 2px solid #a16207;
  background: linear-gradient(165deg, #1a1f2e 0%, #2d1f4a 45%, #1f2937 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 18px 40px rgba(0, 0, 0, 0.45),
    0 4px 0 #713f12;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mafia-role-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  border: 1px dashed rgba(251, 191, 36, 0.25);
  pointer-events: none;
}

.mafia-card-step {
  font-size: 0.8rem;
  color: #a8a29e;
  letter-spacing: 0.03em;
}

.mafia-card-player {
  margin: 4px 0 0;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  color: #fef9c3;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.mafia-card-role {
  margin: 0;
  font-size: clamp(1.2rem, 4.5vw, 1.55rem);
  font-weight: 600;
  color: #86efac;
  line-height: 1.4;
}

.mafia-role-card--done .mafia-card-player {
  font-size: 1.5rem;
  color: #e5e7eb;
}

.mafia-role-card--done .mafia-card-role {
  font-size: 1rem;
  color: #93c5fd;
}

.mafia-nav-buttons {
  display: flex;
  gap: 10px;
  max-width: 340px;
  margin: 0 auto;
}

.mafia-nav-buttons .neutral-btn,
.mafia-nav-buttons .draw-btn {
  flex: 1;
  margin: 0;
  padding: 14px 12px;
  font-size: 1rem;
}

.mafia-next-btn {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  padding: 14px 20px;
  font-size: 1.05rem;
}

.mafia-restart-btn {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 12px auto 0;
  padding: 11px 18px;
  font-size: 0.95rem;
}

.mafia-narrator-card {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(69, 26, 3, 0.22);
}

.mafia-narrator-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.mafia-narrator-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.mafia-narrator-hint {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: #fcd34d;
}

.mafia-narrator-panel {
  overflow-x: auto;
}

.mafia-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.mafia-table th,
.mafia-table td {
  border: 1px solid #374151;
  padding: 8px 10px;
  text-align: right;
}

.mafia-table th {
  background: rgba(31, 41, 55, 0.8);
  color: #fde68a;
}

.mafia-table tr.mafia-row-revealed td {
  color: #86efac;
}

/* PWA install prompt */
.pwa-install {
  position: fixed;
  inset: auto 16px 16px 16px;
  z-index: 9999;
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.pwa-install--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.pwa-install-card {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon body"
    "actions actions";
  gap: 12px 14px;
  padding: 16px 16px 14px;
  background: linear-gradient(160deg, #1e293b, #0f172a);
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  position: relative;
}

.pwa-install-icon img {
  display: block;
  border-radius: 12px;
  grid-area: icon;
}

.pwa-install-body {
  grid-area: body;
  min-width: 0;
}

.pwa-install-title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.pwa-install-desc,
.pwa-install-ios {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
}

.pwa-install-ios strong {
  color: var(--accent);
}

.pwa-install-actions {
  grid-area: actions;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pwa-install-actions .primary-btn,
.pwa-install-actions .secondary-btn {
  flex: 1 1 auto;
  min-width: 120px;
  margin: 0;
}

.pwa-install-close {
  position: absolute;
  top: 8px;
  left: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.pwa-install-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 480px) {
  .pwa-install {
    inset: auto 10px 10px 10px;
  }

  .pwa-install-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "icon"
      "body"
      "actions";
    text-align: center;
  }

  .pwa-install-icon {
    justify-self: center;
  }
}
