:root {
  --bg: #0f1220;
  --panel: #171a2b;
  --panel-2: #1e2338;
  --text: #e8ecf7;
  --muted: #9aa3ba;
  --accent: #7c9bff;
  --success: #38d39f;
  --danger: #ff6b6b;
  --warning: #ffd166;
  --outline: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font: 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu;
  color: var(--text);
  background: linear-gradient(180deg, #0b0e1b, #0f1220 30%, #0f1220 70%, #0b0e1b);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols {
  grid-template-columns: repeat(12, 1fr);
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--outline);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--outline);
}

.card-title {
  font-weight: 700;
  letter-spacing: 0.3px;
}

.card-sub {
  color: var(--muted);
  font-size: 13px;
}

.card-content {
  padding: 18px;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  flex: 1;
  min-width: 180px;
}

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

select, input[type="text"], button, textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: #0f1426;
  color: var(--text);
  padding: 12px 12px;
  font-size: 15px;
}

select:focus, input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.btn {
  cursor: pointer;
  border: 1px solid var(--outline);
  background: linear-gradient(180deg, #1c2441, #16203c);
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 600;
}

.btn:hover {
  filter: brightness(1.1);
}

.btn.primary {
  background: linear-gradient(180deg, #3a56ff, #2c47e6);
  border: none;
  color: white;
}

.btn.ghost {
  background: transparent;
}

.btn.success {
  background: linear-gradient(180deg, #2bbd8e, #20a57b);
  border: none;
}

.btn.danger {
  background: linear-gradient(180deg, #ff7a7a, #ea5455);
  border: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--outline);
  background: #121733;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}

.kudos {
  font-size: 13px;
  color: var(--muted);
}

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

.note {
  border: 1px dashed var(--outline);
  border-radius: 14px;
  padding: 10px;
}

.note-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.note h4 {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.note ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 48px 48px;
  gap: 4px;
  align-items: start;
}

.note li {
  display: contents;
  min-height: fit-content;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  height: auto;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: #0f1426;
  padding: 6px 10px;
  text-align: center;
  line-height: 1.2;
  word-wrap: break-word;
  white-space: normal;
}

.mark {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: #0f1426;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: start;
  margin-top: 4px;
}

.mark[data-state="?"] {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.15) inset;
}

.mark[data-state="X"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.12) inset;
}

.mark[data-state="✓"] {
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(56, 211, 159, 0.12) inset;
}

.mark span {
  font-weight: 800;
  font-size: 16px;
  opacity: 0.9;
}

.result {
  padding: 12px;
  border-radius: 12px;
  background: #0e152e;
  border: 1px solid var(--outline);
}

.result.ok {
  border-color: rgba(56, 211, 159, 0.4);
  background: linear-gradient(180deg, rgba(56, 211, 159, 0.06), #0e152e);
}

.result.bad {
  border-color: rgba(255, 107, 107, 0.4);
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.06), #0e152e);
}

details {
  background: #0e152e;
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 10px 12px;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.reveal {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reveal .seal {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fa5c5c, #b23333);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  letter-spacing: 1px;
  border: 2px solid #fff1;
}

.reveal .hint {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

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

.grow {
  flex: 1;
}

.right {
  margin-left: auto;
}

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

.players-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.players-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.player-name-input {
  flex: 1;
  min-width: 200px;
  font-size: 14px;
  max-width: 300px;
  padding: 10px 12px;
}

.player-name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124, 155, 255, 0.2);
}



.players-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.note-header-row {
  display: contents;
}

/* Автоматическая высота для заголовков игроков */
.header-pill.player-header {
  height: auto;
  min-height: 40px;
  max-height: none;
  overflow: visible;
}

.header-pill {
  background: var(--panel-2);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  align-self: end;
}

.header-pill.player-header {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  height: auto;
  min-height: 50px;
  padding: 4px 0;
  align-self: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50px;
  justify-content: flex-start;
}

/* Стили для широких экранов (десктоп) */
@media (min-width: 921px) {
  .mark {
    height: 32px;
  }
  
  .mark span {
    font-size: 14px;
  }
  
  .pill {
    min-height: 36px;
    padding: 6px 10px;
  }
  
  .note ul {
    gap: 3px;
  }
}

/* Адаптивные стили для узких экранов */
@media (max-width: 920px) {
  .split {
    grid-template-columns: 1fr;
  }
  
  .app {
    padding: 16px;
  }
  
  .card-content {
    padding: 16px;
  }
  
  .card-header {
    padding: 14px 16px;
  }
  
  .row {
    gap: 10px;
  }
  
  .field {
    min-width: 160px;
  }
  
  .toolbar {
    gap: 6px;
  }
  
  .btn {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .players-actions {
    flex-direction: column;
  }
  
  .player-input-row {
    gap: 6px;
  }
  
  .player-name-input {
    min-width: 150px;
  }
  

}

@media (max-width: 768px) {
  .app {
    padding: 12px;
  }
  
  .card-content {
    padding: 14px;
  }
  
  .card-header {
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .toolbar {
    width: 100%;
    justify-content: space-between;
  }
  
  .row {
    flex-direction: column;
    gap: 8px;
  }
  
  .field {
    min-width: auto;
  }
  
  .note-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .note ul {
    grid-template-columns: 1fr 22px 22px;
    gap: 6px;
  }
  
  .header-pill {
    height: 35px;
    font-size: 10px;
  }
  
  .header-pill.player-header {
    min-height: 45px;
    align-self: start;
    max-width: 45px;
    justify-content: flex-start;
  }
  
  .pill {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
  }
  
  .mark {
    height: 28px;
  }
  
  .pill {
    height: 36px;
    font-size: 13px;
  }
  
  .reveal {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .reveal .hint {
    font-size: 11px;
  }
  
  .split {
    gap: 12px;
  }
  
  .grid {
    gap: 12px;
  }
  
  .card {
    border-radius: 16px;
  }
  
  .btn {
    padding: 12px 16px;
    font-size: 15px;
  }
  
  select, input[type="text"], button, textarea {
    padding: 10px 12px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 8px;
  }
  
  .card-content {
    padding: 12px;
  }
  
  .card-header {
    padding: 10px 12px;
  }
  
  .card-title {
    font-size: 15px;
  }
  
  .card-sub {
    font-size: 12px;
  }
  
  .note-grid {
    gap: 12px;
  }
  
  .note {
    padding: 8px;
  }
  
  .note h4 {
    font-size: 13px;
  }
  
  .note ul {
    grid-template-columns: 1fr 20px 20px;
    gap: 4px;
  }
  
  .header-pill {
    height: 32px;
    font-size: 9px;
  }
  
  .header-pill.player-header {
    min-height: 42px;
    align-self: start;
    max-width: 42px;
    justify-content: flex-start;
  }
  
  .pill {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
  }
  
  .mark {
    height: 26px;
    border-radius: 8px;
  }
  
  .pill {
    height: 34px;
    font-size: 12px;
    padding: 0 8px;
  }
  
  .btn {
    padding: 10px 14px;
    font-size: 14px;
  }
  
  .toolbar {
    gap: 4px;
  }
  
  .toolbar .btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .reveal .seal {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .reveal .hint {
    font-size: 10px;
  }
  
  .badge {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  .kudos {
    font-size: 12px;
  }
  
  .small {
    font-size: 11px;
  }
  
  .note-header .btn {
    padding: 3px 6px;
    font-size: 11px;
    height: 22px;
  }
  
  .player-name-input {
    min-width: 120px;
  }
  
}
