:root {
  --glass: rgba(218, 229, 224, .28);
  --glass-strong: rgba(25, 48, 39, .72);
  --glass-line: rgba(255, 255, 255, .28);
  --text: #f5faf7;
  --text-soft: #c7d2cd;
  --accent: #59e78e;
  --accent-deep: #209b58;
  --danger: #ffaaa3;
  --shadow: 0 18px 50px rgba(2, 12, 8, .28);
  color: var(--text);
  background: #12251e;
}

html { min-height: 100%; background: #12251e; }
body {
  min-height: 100dvh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(8, 25, 19, .18), rgba(8, 25, 19, .58)),
    url('/pitch-aerial-bg.png') center / cover fixed;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: linear-gradient(90deg, rgba(5, 19, 14, .18), transparent 45%, rgba(5, 19, 14, .18));
}

header {
  min-height: 112px;
  padding: max(22px, env(safe-area-inset-top)) max(22px, calc((100vw - 900px) / 2));
  justify-content: flex-start;
  background: transparent;
  text-align: left;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 44px; height: 44px; filter: drop-shadow(0 7px 14px #03140d99); }
header h1 { margin: 0; font-size: clamp(21px, 4vw, 30px); letter-spacing: -.025em; }
.brand p { margin: 4px 0 0; color: var(--text-soft); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.header-user { top: max(22px, env(safe-area-inset-top)); }
.header-user #user-menu {
  border: 1px solid var(--glass-line);
  background: rgba(225, 237, 231, .22);
  color: #fff;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(130%);
}
.header-user #user-menu[aria-expanded='true'] { background: var(--accent); color: #10241b; }
.header-user #logout { border-color: var(--glass-line); background: rgba(18, 37, 30, .94); color: #fff; }

main { max-width: 760px; padding: 8px 20px 142px; }
#app > h2 {
  margin: 12px 0 30px;
  color: #fff;
  font-size: clamp(42px, 10vw, 72px);
  line-height: 1;
  letter-spacing: -.055em;
  text-shadow: 0 8px 28px rgba(0, 0, 0, .35);
}
.match-filter-tabs { display: flex; width: min(100%, 430px); margin: -12px auto 28px; padding: 4px; border: 1px solid var(--glass-line); border-radius: 999px; background: rgba(18,37,30,.58); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.match-filter-tab { flex: 1; min-height: 42px; padding: 8px 12px; background: transparent; color: var(--text-soft); box-shadow: none; text-transform: none; }
.match-filter-tab.active { background: rgba(89,231,142,.2); color: #79f0a6; }
.home-filter-empty { text-align: center; }

.card, .home-match-preview, .match-history, dialog {
  border: 1px solid var(--glass-line);
  background: var(--glass-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
}
.card, .home-match-preview, dialog { border-radius: 28px; }
.card { padding: 22px; }
.meta, .chat-message time { color: var(--text-soft); }

button {
  min-height: 46px;
  background: linear-gradient(135deg, var(--accent), #48ca7c);
  color: #0f2c1f;
  box-shadow: 0 10px 24px rgba(22, 194, 94, .18);
}
button:hover { filter: brightness(1.05); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
button.secondary { border: 1px solid var(--glass-line); background: rgba(255,255,255,.1); color: #fff; box-shadow: none; }
button.no { border: 1px solid rgba(255,170,163,.55); background: rgba(115,43,38,.36); color: #ffe3e0; box-shadow: none; }
input, select, textarea { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.92); color: #17251e; }

.home-match-history { gap: 18px; padding: 0; background: transparent; border: 0; box-shadow: none; backdrop-filter: none; }
.home-match-preview { overflow: hidden; }
.home-match-summary { position: relative; }
.home-match-details {
  padding: 24px 22px 18px;
  background: transparent;
  text-align: left;
  font-size: clamp(17px, 4vw, 22px);
  line-height: 1.45;
}
.match-schedule { color: #fff; font-size: 1.08em; }
.match-schedule::before { content: '▣'; margin-right: 12px; color: var(--text-soft); }
.match-place { margin-top: 7px; color: var(--text-soft); font-weight: 650; }
.match-place::before { content: '●'; margin-right: 14px; font-size: .64em; color: var(--text-soft); }
.home-match-actions {
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 18px 22px 22px;
  border-top: 1px solid rgba(255,255,255,.16);
  background: transparent;
}
.home-match-actions .match-status {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(50, 183, 103, .62);
  color: #fff;
  letter-spacing: .06em;
}
.home-match-actions .match-status::before { background: #fff; }
.preview-count { color: var(--text-soft); font-size: 14px; font-weight: 750; }
.preview-responses { grid-column: 1 / -1; grid-row: 2; width: 100%; }
.preview-responses .response-option { flex: 1; min-height: 58px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.08); color: #fff; box-shadow: none; }
.preview-responses .response-option.selected.yes, .preview-responses .response-option.yes { border-color: #73f3a4; background: linear-gradient(135deg, #59e78e, #35b969); color: #0f2c1f; box-shadow: 0 10px 24px rgba(35,200,103,.22); }
.preview-responses .response-option.selected.no { border-color: rgba(255,170,163,.55); background: rgba(115,43,38,.36); color: #ffe3e0; box-shadow: none; }
.match-toggle { grid-column: 2; grid-row: 1; width: 42px; height: 42px; min-height: 42px; border: 1px solid var(--glass-line); background: rgba(255,255,255,.12); color: #fff; box-shadow: none; }
.home-match-preview .match-detail .accordion-card { border-top-color: rgba(255,255,255,.16); background: transparent; }

.section-open, .chat-section, .chat-open { border-color: var(--glass-line); background: rgba(255,255,255,.09); }
.convocations, .teams-section, .chat-section { border-top: 1px solid rgba(255,255,255,.18); }
.convocations-open, .teams-open, .chat-open { min-height: 76px; border-radius: 18px; background: rgba(255,255,255,.09); }
.section-open-icon, .chat-open-icon { background: rgba(255,255,255,.16); }
.chat-bell { background: rgba(255,255,255,.9); }
.primary-response { border-color: var(--glass-line); background: rgba(255,255,255,.08); }
.team, .teams-section .team, .teams-dialog .team { border-color: var(--glass-line); background: rgba(255,255,255,.09); }
.players .current-player { background: rgba(89,231,142,.2); color: #fff; }
.badge { background: rgba(255,255,255,.86); color: #173a2b; }
.called, .device-approved { background: #80efa9; }
.waiting, .device-pending { background: #ffe09a; }
.declined { background: #ffc0ba; }
.result { background: rgba(255,255,255,.1); }
.accordion, .management-actions, .static-match-details { border-color: rgba(255,255,255,.15); }
.match-date { color: #fff; }
.match-date:hover, .match-date.active { background: rgba(255,255,255,.1); }
.chat-message { background: rgba(255,255,255,.9); }
.chat-message.mine { background: #d7f8e3; }
.chat-dialog, .match-section-dialog, .convocations-dialog, .teams-dialog,
.chat-dialog-header, .match-section-dialog-header { background: rgba(18,37,30,.96); }

nav {
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: auto;
  max-width: 740px;
  margin: auto;
  padding: 9px;
  border: 1px solid var(--glass-line);
  border-radius: 24px;
  background: rgba(26, 48, 40, .78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  overflow-x: auto;
}
nav button { min-width: 82px; min-height: 56px; padding: 8px 12px; background: transparent; color: var(--text-soft); box-shadow: none; }
nav button::before {
  content: '';
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 4px;
  background-color: currentColor;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}
nav button[data-view='home']::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='m12 7 3.1 2.2-1.2 3.6h-3.8L8.9 9.2 12 7Zm-3.1 2.2L5.8 8m4.3 4.8-2.2 3.1m6-3.1 2.2 3.1m-8.2 0 .8 3.6m7.4-3.6-.8 3.6M15.1 9.2 18.2 8' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='m12 7 3.1 2.2-1.2 3.6h-3.8L8.9 9.2 12 7Zm-3.1 2.2L5.8 8m4.3 4.8-2.2 3.1m6-3.1 2.2 3.1m-8.2 0 .8 3.6m7.4-3.6-.8 3.6M15.1 9.2 18.2 8' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
nav button[data-view='manage']::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='4' width='16' height='16' rx='2' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M8 8h3v3H8zm5 0h3v3h-3zM8 13h3v3H8zm5 0h3v3h-3z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='4' width='16' height='16' rx='2' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M8 8h3v3H8zm5 0h3v3h-3zM8 13h3v3H8zm5 0h3v3h-3z'/%3E%3C/svg%3E");
}
nav button[data-view='players']::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='16.5' cy='9' r='2.5'/%3E%3Cpath d='M3.5 19v-1.8A5.5 5.5 0 0 1 9 11.7a5.5 5.5 0 0 1 5.5 5.5V19H3.5Zm11.8 0v-1.5a6.8 6.8 0 0 0-1.7-4.5 4.8 4.8 0 0 1 7 4.2V19h-5.3Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='16.5' cy='9' r='2.5'/%3E%3Cpath d='M3.5 19v-1.8A5.5 5.5 0 0 1 9 11.7a5.5 5.5 0 0 1 5.5 5.5V19H3.5Zm11.8 0v-1.5a6.8 6.8 0 0 0-1.7-4.5 4.8 4.8 0 0 1 7 4.2V19h-5.3Z'/%3E%3C/svg%3E");
}
nav button[data-view='settings']::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.7 3.7h4.6l.6 2.1 2 .9 2-.9 2.3 4-1.6 1.5.2 2.2 1.4 1.7-2.3 4-2.1-.7-1.9 1.2-.6 2.1H9.7l-.6-2.1-1.9-1.2-2.1.7-2.3-4 1.4-1.7.2-2.2-1.6-1.5 2.3-4 2 .9 2-.9.6-2.1ZM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.7 3.7h4.6l.6 2.1 2 .9 2-.9 2.3 4-1.6 1.5.2 2.2 1.4 1.7-2.3 4-2.1-.7-1.9 1.2-.6 2.1H9.7l-.6-2.1-1.9-1.2-2.1.7-2.3-4 1.4-1.7.2-2.2-1.6-1.5 2.3-4 2 .9 2-.9.6-2.1ZM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z'/%3E%3C/svg%3E");
}
nav button[data-view='notifications']::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 17h14l-1.7-2.4V10a5.3 5.3 0 0 0-4.3-5.2V3h-2v1.8A5.3 5.3 0 0 0 6.7 10v4.6L5 17Z' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M9.5 19a2.7 2.7 0 0 0 5 0' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 17h14l-1.7-2.4V10a5.3 5.3 0 0 0-4.3-5.2V3h-2v1.8A5.3 5.3 0 0 0 6.7 10v4.6L5 17Z' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M9.5 19a2.7 2.7 0 0 0 5 0' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
nav button[data-view='profile']::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='3.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M5.5 20a6.5 6.5 0 0 1 13 0H5.5Z' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='3.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M5.5 20a6.5 6.5 0 0 1 13 0H5.5Z' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E");
}
nav button.active { background: rgba(89,231,142,.16); color: #70f0a1; }

#toast { background: rgba(10,29,21,.94); border: 1px solid var(--glass-line); box-shadow: var(--shadow); }

@media (max-width: 560px) {
  body { background-position: center top; }
  header { min-height: 72px; padding: max(16px, env(safe-area-inset-top)) 20px 8px; }
  .brand { gap: 9px; }
  .brand img { width: 28px; height: 28px; }
  header h1 { font-size: 16px; }
  .brand p { display: none; }
  .header-user { top: max(12px, env(safe-area-inset-top)); right: 18px; }
  .header-user #user-menu { width: 36px; height: 36px; font-size: 12px; }
  main { padding: 12px 16px 112px; }
  #app > h2 { margin: 4px 0 44px; font-size: 40px; letter-spacing: -.035em; }
  .match-filter-tabs { width: 100%; margin: -26px auto 34px; padding: 3px; }
  .match-filter-tab { min-height: 38px; font-size: 12px; }
  .home-match-preview { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
  .home-match-details { position: relative; padding: 20px 18px 14px; border: 1px solid var(--glass-line); border-bottom: 0; border-radius: 17px 17px 0 0; background: var(--glass-strong); font-size: 15px; backdrop-filter: blur(22px) saturate(125%); }
  .match-schedule::before { margin-right: 9px; }
  .match-place { margin-top: 5px; font-size: 13px; }
  .match-place::before { margin-right: 10px; }
  .home-match-actions { position: relative; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 16px 18px; border: 1px solid var(--glass-line); border-top-color: rgba(255,255,255,.14); border-radius: 0 0 17px 17px; background: var(--glass-strong); backdrop-filter: blur(22px) saturate(125%); }
  .home-match-actions.registrations-closed { padding-bottom: 20px; }
  .home-match-actions .match-status { padding: 7px 10px; font-size: 10px; }
  .preview-count { grid-column: 2; grid-row: 1; align-self: center; padding-right: 2px; font-size: 12px; }
  .preview-responses { grid-template-columns: 1fr 1fr; }
  .preview-responses .response-option { min-height: 50px; padding-inline: 5px; border-radius: 10px; font-size: 12px; }
  .match-toggle {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: -17px;
    top: auto;
    right: auto;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    transform: translateX(-50%);
    border: 2px solid rgba(255,255,255,.9);
    border-radius: 50%;
    background: rgba(30,55,46,.96);
    color: #fff;
    font-size: 22px;
    font-weight: 500;
    line-height: 1;
    box-shadow: 0 7px 18px rgba(0,0,0,.38);
  }
  .match-toggle::before { content: none; }
  .match-toggle[aria-expanded='true'] { background: rgba(30,55,46,.96); }
  .match-detail .accordion-card { margin: 24px 0 0 !important; padding: 0 !important; overflow: hidden; border: 1px solid var(--glass-line) !important; border-radius: 17px !important; background: var(--glass-strong) !important; box-shadow: var(--shadow) !important; backdrop-filter: blur(22px) saturate(125%); }
  .match-detail .management-actions, .match-detail .primary-response { display: none; }
  .match-window-launcher, .chat-section { min-height: 0; margin: 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.17); border-radius: 0; background: transparent; }
  .chat-section:last-child { border-bottom: 0; }
  .section-open, .chat-open { display: flex; align-items: center; width: 100%; min-height: 58px; padding: 11px 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .convocation-title, .teams-title, .chat-title { margin: 0; text-align: left; font-size: 14px; }
  .personal-summary-row, .teams-summary-row { display: none; }
  .section-open-icon, .chat-open-icon { margin-left: auto; background: transparent; color: var(--text-soft); font-size: 0; }
  .section-open-icon::before, .chat-open-icon::before { content: '›'; font-size: 24px; font-weight: 300; }
  .chat-section { display: flex; align-items: center; justify-content: flex-start; padding: 0 50px 0 12px; }
  .chat-open { flex: 0 1 auto; width: auto; min-height: 58px; margin: 0; padding: 11px 4px; }
  .chat-title { margin: 0; padding: 0; white-space: nowrap; }
  .chat-bell { position: relative; z-index: 2; left: auto; right: auto; top: auto; transform: none; flex: 0 0 27px; width: 27px; height: 27px; margin: 0 0 0 7px; background: transparent; color: var(--text-soft); }
  .chat-open-icon { position: absolute; right: 14px; }
  .home-match-history { gap: 16px; }
  nav { justify-content: flex-start; }
  nav { left: 0; right: 0; bottom: 0; max-width: none; padding: 6px 8px max(7px, env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 0; }
  nav button { flex: 1; min-width: 70px; min-height: 54px; padding: 7px 4px; border-radius: 14px; font-size: 10px; }
  nav button::before { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
@supports not (backdrop-filter: blur(1px)) { .card, .home-match-preview, nav { background: rgba(24,47,38,.94); } }

/* Finestre modulari: un solo linguaggio visivo, senza i colori del tema precedente. */
.match-section-dialog,
.chat-dialog {
  border: 4px solid rgba(255, 255, 255, .96);
  background: rgba(18, 37, 30, .94);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .52), 0 0 0 1px rgba(255, 255, 255, .18) inset;
}
.match-section-dialog::backdrop,
.chat-dialog::backdrop { background: rgba(4, 16, 11, .74); }
.convocations-dialog,
.teams-dialog,
.convocations-dialog .match-section-dialog-shell,
.teams-dialog .match-section-dialog-shell,
.chat-dialog .chat-dialog-shell,
.convocations-dialog .match-section-dialog-header,
.teams-dialog .match-section-dialog-header,
.chat-dialog .chat-dialog-header,
.convocations-dialog .match-section-dialog-body,
.teams-dialog .match-section-dialog-body,
.chat-dialog .chat-body {
  background: transparent;
  color: var(--text);
}
.match-section-dialog-header,
.chat-dialog-header { border-bottom: 1px solid rgba(255, 255, 255, .2); }
.convocations-dialog .player,
.teams-dialog .team,
.chat-dialog .chat-message {
  border-color: rgba(255, 255, 255, .2);
}
.convocations-dialog .current-player { background: rgba(89, 231, 142, .18); color: #fff; }
.teams-dialog .team { background: rgba(255, 255, 255, .08); color: #fff; }
.chat-dialog .chat-message { background: rgba(255, 255, 255, .9); color: #17251e; }
.chat-dialog .chat-message.mine { background: #d7f8e3; }
.match-section-dialog .section-dialog-close,
.chat-dialog .chat-close { background: #fff; color: #173a2b; box-shadow: none; }
.chat-dialog .mention-menu { border-color: rgba(255,255,255,.22); background: rgba(18,37,30,.98); box-shadow: 0 18px 42px rgba(0,0,0,.5); }
.chat-dialog .mention-option { color: #fff; }
.chat-dialog .mention-option:hover,
.chat-dialog .mention-option.active { background: rgba(89,231,142,.2); color: #fff; }
