:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #120d0a;
    color: #fff7ea;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    background: radial-gradient(circle at 15% 0%, rgba(188, 112, 43, .2), transparent 30%), linear-gradient(150deg, #26180f 0%, #120d0a 62%);
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.attendance-shell { width: min(1180px, 100%); margin: 0 auto; padding: 24px; }

.page-header, .panel, .event-card, .stat-card, .modal-card {
    border: 1px solid rgba(255, 220, 171, .14);
    background: rgba(37, 24, 17, .88);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
}

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 21px; border-radius: 20px; }
.header-copy, .header-actions, .panel-heading, .section-heading, .modal-heading, .event-heading, .event-actions, .player-name-line { display: flex; align-items: center; }
.header-copy { gap: 16px; }
.header-actions { gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.back-link {
    min-width: 82px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .11); border-radius: 11px;
    background: rgba(255, 255, 255, .06); color: #ffeed5; font-size: 13px; font-weight: 850; text-align: center; text-decoration: none;
}

.eyebrow { margin: 0 0 4px; color: #eda953; font-size: 10px; font-weight: 950; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; }
h1 { margin-bottom: 5px; font-size: clamp(24px, 4vw, 38px); }
h2 { margin-bottom: 0; font-size: 25px; }
h3 { margin-bottom: 2px; font-size: 18px; }
.subtitle, .event-meta, .empty-copy { margin-bottom: 0; color: rgba(255, 245, 228, .62); font-size: 13px; }

.button, .icon-button { border: 1px solid rgba(255, 255, 255, .13); color: #fff; font-weight: 900; cursor: pointer; }
.button { min-height: 43px; padding: 9px 14px; border-radius: 11px; font-size: 13px; }
.button.primary { background: linear-gradient(135deg, #d38a3d, #a95823); }
.button.secondary { background: rgba(255, 255, 255, .07); }
.button.danger { background: rgba(174, 49, 40, .19); color: #ff9c91; }
.button:disabled { opacity: .45; cursor: default; }
.icon-button { width: 40px; height: 40px; border-radius: 11px; background: rgba(255, 255, 255, .06); font-size: 24px; }

.access-badge, .role-badge, .strike-badge, .status-chip { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 11px; font-weight: 900; }
.access-badge { padding: 7px 10px; background: rgba(255, 255, 255, .07); color: #c8bba9; }
.access-badge.unlocked { background: rgba(62, 180, 103, .16); color: #83e5a4; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin: 15px 0; }
.stat-card { display: flex; flex-direction: column; gap: 4px; padding: 17px; border-radius: 16px; }
.stat-card span { color: rgba(255, 245, 228, .62); font-size: 12px; }
.stat-card strong { font-family: Georgia, serif; font-size: 29px; }
.stat-card.warning strong { color: #ffc764; }
.stat-card.danger strong { color: #ff8074; }

.panel { padding: 20px; border-radius: 18px; }
.panel-heading, .section-heading, .event-heading, .modal-heading { justify-content: space-between; gap: 16px; }
.search-input, input, textarea, select { border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; outline: none; background: rgba(8, 6, 5, .48); color: #fff8eb; }
.search-input { width: min(260px, 45%); padding: 10px 12px; }
input, textarea, select { width: 100%; padding: 10px 11px; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: #d99245; box-shadow: 0 0 0 3px rgba(217, 146, 69, .12); }

.watchlist { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.watch-player { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 11px; background: rgba(255, 255, 255, .045); font-size: 13px; font-weight: 750; }
.watch-player.blocked { border-color: rgba(255, 91, 77, .42); background: rgba(150, 35, 28, .13); }
.strike-badge { min-width: 38px; padding: 4px 7px; background: rgba(255, 193, 84, .14); color: #ffc765; }
.strike-badge.zero { background: rgba(80, 191, 118, .12); color: #86e2a3; }
.strike-badge.blocked { background: rgba(255, 80, 67, .16); color: #ff8d83; }

.events-section { margin-top: 22px; }
.section-heading { margin-bottom: 12px; padding: 0 3px; }
.events-list { display: grid; gap: 13px; }
.event-card { overflow: hidden; border-radius: 18px; }
.event-heading { padding: 17px 18px; cursor: pointer; }
.event-heading:hover { background: rgba(255, 255, 255, .025); }
.event-actions { gap: 8px; }
.summary-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.status-chip { padding: 5px 8px; background: rgba(255, 255, 255, .065); color: #d6c8b5; }
.status-chip.good { color: #82e2a1; background: rgba(58, 173, 96, .13); }
.status-chip.bad { color: #ff8f84; background: rgba(189, 49, 40, .13); }
.event-body { border-top: 1px solid rgba(255, 255, 255, .08); }
.participant-list { display: grid; }
.participant-row { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(145px, .7fr) minmax(180px, 1fr) auto; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid rgba(255, 255, 255, .055); }
.participant-row:last-child { border-bottom: 0; }
.player-name-line { gap: 6px; min-width: 0; flex-wrap: wrap; }
.player-name { overflow: hidden; font-size: 14px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.role-badge { padding: 4px 7px; background: rgba(82, 164, 218, .12); color: #8fd0f7; }
.role-badge.substitute { background: rgba(166, 113, 224, .13); color: #c9a2f1; }
.role-toggle { border: 0; cursor: pointer; }
.role-toggle:disabled { cursor: default; }
.mini-button { display: inline-grid; width: 27px; height: 27px; padding: 0; place-items: center; border: 1px solid rgba(255, 255, 255, .1); border-radius: 8px; background: rgba(255, 255, 255, .055); font-size: 12px; cursor: pointer; }
.mini-button.danger { background: rgba(168, 43, 35, .1); }
.participant-note { min-width: 0; }
.save-state { width: 52px; color: #84dfa2; font-size: 11px; font-weight: 850; text-align: right; }
.event-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid rgba(255, 255, 255, .08); background: rgba(0, 0, 0, .12); }
.empty-state { padding: 34px 20px; text-align: center; }
.empty-state strong { display: block; margin-bottom: 6px; font-size: 18px; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(5, 3, 2, .76); backdrop-filter: blur(7px); }
.modal-card { width: min(760px, 100%); max-height: calc(100vh - 36px); overflow: auto; padding: 22px; border-radius: 20px; }
.form-grid, .roster-grid { display: grid; gap: 13px; }
.form-grid { grid-template-columns: 1fr 180px; margin-top: 18px; }
.roster-grid { grid-template-columns: 3fr 1fr; margin-top: 15px; }
label { display: grid; gap: 7px; color: #ffe7c5; font-size: 12px; font-weight: 850; }
label small { color: rgba(255, 245, 228, .5); font-weight: 650; }
.counter { text-align: right; }
.counter.over { color: #ff8378; }
.form-message { min-height: 20px; margin: 12px 0 0; color: #ff9186; font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 10px; }

.toast { position: fixed; z-index: 150; left: 50%; bottom: 22px; max-width: calc(100% - 30px); padding: 11px 15px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 11px; background: #2d2119; box-shadow: 0 12px 35px rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s ease; font-size: 13px; font-weight: 800; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
    .attendance-shell { padding: 11px; }
    .page-header { align-items: stretch; flex-direction: column; padding: 16px; }
    .header-copy { align-items: flex-start; flex-direction: column; gap: 11px; }
    .header-actions { justify-content: stretch; }
    .header-actions .button { flex: 1; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .panel { padding: 15px; }
    .panel-heading { align-items: stretch; flex-direction: column; }
    .search-input { width: 100%; }
    .participant-row { grid-template-columns: minmax(0, 1fr) 125px; gap: 8px; padding: 12px; }
    .participant-note { grid-column: 1 / -1; }
    .save-state { position: absolute; visibility: hidden; }
    .form-grid, .roster-grid { grid-template-columns: 1fr; }
    .event-heading { align-items: flex-start; flex-direction: column; }
    .event-actions { width: 100%; justify-content: space-between; }
    .event-footer { justify-content: stretch; }
    .event-footer .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
