/**
 * HistoryGram - Foglio di Stile Ufficiale
 * Ecosistema Prof. Memmo - Conforme Regole Operative v2.1
 */

:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #121722;
  --bg-card: #182030;
  --bg-card-hover: #222c40;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.06);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-gold: #d4af37;
  --accent-gold-light: #fef08a;
  --accent-red: #ef4444;
  --accent-purple: #833ab4;
  --accent-blue: #0284c7;
  --accent-green: #10b981;

  --instagram-grad: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --parchment-grad: linear-gradient(135deg, #fefae0 0%, #e9edc9 100%);
  --gold-grad: linear-gradient(135deg, #bf953f 0%, #fcf6ba 50%, #b38728 100%);

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Cinzel', serif;
  --font-editorial: 'Newsreader', serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65);
}

/* Regola Obbligatoria Art. 4 - Isolamento Modali */
.hidden, [hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-ui);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

#app-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ================= HEADER DELL'ECOSISTEMA (BRAND UNIFORME) ================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 20px;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Sinistra: Logo Gioco */
.header-left {
  display: flex;
  align-items: center;
}

.header-game-logo {
  height: 44px;
  max-width: 200px;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.header-game-logo:hover {
  transform: scale(1.02);
}

/* Centro: Avatar Prof. Memmo */
.header-center-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-prof-logo-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--accent-gold);
  background: var(--bg-card);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.header-prof-logo-wrapper:hover {
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

.header-prof-logo {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  aspect-ratio: 1/1;
}

/* Destra: Pillola Classe & Profilo SSO */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.room-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
}

.room-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.room-label {
  color: var(--text-muted);
}

.btn-icon-subtle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  margin-left: 2px;
}

.user-menu-container {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 5px 12px 5px 5px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.2s ease;
}

.user-menu-trigger:hover {
  background: var(--bg-card-hover);
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-circle img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  aspect-ratio: 1/1;
}

.user-name-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 240px;
  padding: 8px 0;
  z-index: 200;
}

.dropdown-header {
  padding: 10px 16px;
}

.dropdown-header strong {
  display: block;
  font-size: 0.9rem;
}

.dropdown-header small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.88rem;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dropdown-item:hover {
  background: var(--bg-card-hover);
}

.text-danger {
  color: var(--accent-red);
}

/* ================= SUB-NAV BAR (MODALITÀ E AZIONI) ================= */
.sub-nav-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 20px;
}

.sub-nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.mode-tabs {
  display: flex;
  background: var(--bg-primary);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.mode-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.mode-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.mode-tab.active {
  background: var(--instagram-grad);
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 39, 67, 0.35);
}

.tab-badge {
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.sub-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-primary-action {
  background: var(--instagram-grad);
  border: none;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(220, 39, 67, 0.35);
  transition: transform 0.2s ease;
}

.btn-primary-action:hover {
  transform: translateY(-1px);
}

.btn-cattedra-action {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease;
  position: relative;
}

.btn-cattedra-action:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.badge-pending-count {
  background: var(--accent-red);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 800;
}

/* ================= BANNER DIDATTICO ================= */
.game-banner {
  border-bottom: 1px solid var(--border-color);
  background: radial-gradient(circle at 10% 20%, rgba(131, 58, 180, 0.16) 0%, transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(220, 39, 67, 0.12) 0%, transparent 45%);
  padding: 24px 20px;
}

.game-banner-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
}

.banner-subtag {
  color: var(--accent-gold);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 6px;
}

.banner-heading {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.25;
}

.banner-description {
  color: var(--text-muted);
  max-width: 740px;
  font-size: 0.95rem;
  margin-top: 8px;
  line-height: 1.5;
}

.banner-status-box {
  display: flex;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  border-radius: var(--radius-md);
}

.status-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.stat-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ================= STORIES D'EPOCA ================= */
.stories-bar-section {
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 16px 20px 20px;
}

.stories-bar-container {
  max-width: 1400px;
  margin: 0 auto;
}

.stories-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stories-bar-header span {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.stories-bar-header small {
  color: var(--accent-gold);
  font-size: 0.78rem;
}

.stories-list {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.story-item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  width: 92px;
  text-align: center;
  transition: transform 0.2s ease;
}

.story-item-card:hover {
  transform: translateY(-2px);
}

.story-ring-border {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  padding: 3px;
  background: var(--instagram-grad);
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-avatar-box {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  user-select: none;
}

.story-title-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.story-score-badge {
  font-size: 0.68rem;
  color: var(--accent-gold);
  font-weight: 700;
  background: rgba(212, 175, 55, 0.12);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* ================= GRID PRINCIPALE ================= */
.main-content-grid {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  flex: 1;
}

.feed-column {
  min-width: 0;
}

.feed-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.feed-live-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-dot {
  width: 10px;
  height: 10px;
  background: var(--accent-red);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-red);
}

.feed-live-indicator h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
}

.feed-posts-count {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.btn-refresh {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh:hover {
  color: #fff;
  background: var(--bg-card-hover);
}

/* Post Cards */
.feed-stream {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.empty-feed-placeholder {
  background: var(--bg-secondary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 50px 24px;
  text-align: center;
}

.placeholder-icon {
  font-size: 3.5rem;
  margin-bottom: 14px;
}

.empty-feed-placeholder h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.empty-feed-placeholder p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 20px;
  font-size: 0.95rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.post-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.post-top-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

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

.post-avatar-frame {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--bg-secondary);
  border: 2px solid var(--accent-gold);
}

.post-name-text strong {
  font-size: 1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-name-text small {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.imprimatur-stamp {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.bonus-pill {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: 6px;
}

.post-banner-headline {
  padding: 22px 24px;
  font-family: var(--font-editorial);
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}

.style-parchment {
  background: var(--parchment-grad);
  color: #2b1d0c;
}

.style-barricade {
  background: linear-gradient(135deg, #780000 0%, #c1121f 100%);
  color: #fff;
}

.style-proclamation {
  background: #1e293b;
  color: #f8fafc;
  border-left: 6px solid var(--accent-gold);
  text-align: left;
}

.style-cathedral {
  background: linear-gradient(135deg, #1f1d36 0%, #3f3351 100%);
  color: #f3e5ab;
}

.post-inner-body {
  padding: 18px 22px;
}

.post-body-text {
  font-size: 1rem;
  color: var(--text-main);
  line-height: 1.6;
  white-space: pre-wrap;
}

.post-tags-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-badge {
  color: #38bdf8;
  font-weight: 600;
  font-size: 0.88rem;
}

.post-teacher-feedback {
  margin-top: 14px;
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid var(--accent-gold);
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.post-teacher-feedback strong {
  color: var(--accent-gold);
}

.post-bottom-actions {
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-like {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-like:hover {
  border-color: var(--accent-red);
  color: #ff6b6b;
}

.btn-like.liked {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #fff;
}

.btn-flame {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease;
}

.btn-flame:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Widget Rating XVI Secolo */
.ratings-bar-box {
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.ratings-numbers {
  display: flex;
  gap: 12px;
  color: var(--text-muted);
}

.ratings-numbers strong {
  color: var(--accent-gold-light);
}

.btn-vote-stars {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
}

/* Commenti / Thread */
.post-thread-comments {
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border-subtle);
  padding: 12px 20px;
}

.thread-item {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}

.thread-item:last-child {
  margin-bottom: 0;
}

.thread-bubble {
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex: 1;
}

.thread-bubble strong {
  color: var(--accent-gold);
  font-size: 0.8rem;
  display: block;
}

/* ================= SIDEBAR LEADERBOARD ================= */
.sidebar-column {
  position: sticky;
  top: 86px;
}

.leaderboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card-header-styled {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

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

.ch-left h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
}

.badge-live {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.card-intro-text {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 18px;
  line-height: 1.4;
}

/* Podio */
.podium-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 10px 0;
}

.podium-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  text-align: center;
}

.podium-char-avatar {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.podium-char-name {
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.podium-block-pillar {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  margin-top: 6px;
}

.pillar-first {
  height: 68px;
  background: var(--gold-grad);
  color: #2b1d0c;
}

.pillar-second {
  height: 50px;
  background: linear-gradient(135deg, #94a3b8 0%, #cbd5e1 100%);
  color: #1e293b;
}

.pillar-third {
  height: 38px;
  background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
  color: #fff;
}

.podium-stat-val {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent-gold);
  margin-top: 4px;
}

/* Tabella */
.table-responsive {
  margin-bottom: 20px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.leaderboard-table th {
  text-align: left;
  padding: 8px 6px;
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

.leaderboard-table td {
  padding: 9px 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.text-right {
  text-align: right;
}

.evaluation-rules-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-subtle);
}

.evaluation-rules-box h4 {
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.evaluation-rules-box ul {
  list-style: none;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evaluation-rules-box strong {
  color: var(--accent-gold-light);
}

/* ================= FOOTER DI COPYRIGHT PATAMU (Art. 4) ================= */
.app-footer {
  margin-top: auto;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 16px 20px;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.patamu-block {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 800px;
}

/* Altezza esattamente a 52px come prescritto dall'Art. 4 */
.patamu-badge {
  height: 52px;
  max-height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}

.patamu-text {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: justify;
  line-height: 1.4;
}

.patamu-text strong {
  color: var(--text-main);
  font-weight: 700;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent-gold);
}

/* ================= MODALI & FORM ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-box.modal-lg {
  max-width: 820px;
}

.modal-box.modal-xl {
  max-width: 960px;
}

.modal-header-styled {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.teacher-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.modal-category-tag {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  display: block;
}

.modal-title-text {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 900;
}

.btn-close-styled {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close-styled:hover {
  color: #fff;
  background: var(--bg-card-hover);
}

.modal-body-padded {
  padding: 22px;
  overflow-y: auto;
}

.modal-body-two-cols {
  padding: 22px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 26px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  color: #fff;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(131, 58, 180, 0.25);
}

.char-count-text {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip-tag {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.76rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-tag:hover {
  color: var(--accent-gold-light);
  border-color: var(--accent-gold);
}

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

.style-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.style-card input {
  display: none;
}

.style-card.active {
  background: rgba(131, 58, 180, 0.2);
  border-color: var(--accent-purple);
  color: #fff;
}

.btn-submit-post {
  width: 100%;
  background: var(--instagram-grad);
  border: none;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 800;
  padding: 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 4px 14px rgba(220, 39, 67, 0.35);
}

.form-disclaimer {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 10px;
}

/* Smartphone Mockup */
.smartphone-frame {
  background: #000;
  border: 8px solid #2d3748;
  border-radius: 36px;
  padding: 10px;
  max-width: 310px;
  margin: 0 auto;
}

.phone-speaker {
  width: 80px;
  height: 16px;
  background: #2d3748;
  border-radius: 0 0 12px 12px;
  margin: 0 auto 8px;
}

.phone-screen-inner {
  background: var(--bg-primary);
  border-radius: 24px;
  padding: 10px;
  min-height: 460px;
}

.phone-status-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding: 0 4px;
}

.preview-card-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.preview-card-head {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-avatar-icon {
  font-size: 1.4rem;
}

.preview-card-head strong {
  display: block;
  font-size: 0.8rem;
}

.preview-card-head small {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.preview-banner-styled {
  padding: 14px 10px;
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.preview-body-styled {
  padding: 10px;
  font-size: 0.82rem;
}

.preview-hashtags {
  color: #38bdf8;
  font-size: 0.74rem;
  margin-top: 6px;
}

.preview-footer-styled {
  padding: 8px 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ================= GESTIONE SQUADRE (MODELLO FANTALETTERATURA) ================= */
.teams-manager-intro {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.teams-grid-distribution {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.team-box-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.team-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.team-box-avatar {
  font-size: 1.5rem;
}

.team-box-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.team-students-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px;
  font-size: 0.85rem;
  font-family: var(--font-ui);
}

.modal-actions-right {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Pin Gate */
.pin-gate-wrap {
  text-align: center;
  padding: 30px 10px;
}

.pin-gate-icon {
  font-size: 2.8rem;
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.pin-form-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  max-width: 320px;
  margin: 16px auto 10px;
}

.pin-box {
  text-align: center;
  font-size: 1.2rem;
  letter-spacing: 0.3em;
}

.pin-hint {
  color: var(--text-dim);
  font-size: 0.78rem;
}

/* Teacher Workarea Tabs */
.teacher-nav-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.t-nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.t-nav-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.queue-cards-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.queue-card-styled {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.queue-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.queue-headline {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--accent-gold-light);
  margin-bottom: 6px;
}

.queue-text-body {
  font-size: 0.92rem;
  margin-bottom: 12px;
}

.queue-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.btn-approve {
  background: var(--accent-green);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.btn-reject {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.settings-grid-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.setting-card h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.setting-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.input-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  max-width: 300px;
}

.danger-zone {
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-danger-action {
  background: var(--accent-red);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-top: 10px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.25s ease;
}

.toast-success { border-left: 4px solid var(--accent-green); }
.toast-info { border-left: 4px solid #38bdf8; }
.toast-gold { border-left: 4px solid var(--accent-gold); }

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

/* ================= RESPONSIVE ================= */
@media (max-width: 1024px) {
  .main-content-grid {
    grid-template-columns: 1fr;
  }
  .sidebar-column {
    position: static;
  }
  .modal-body-two-cols {
    grid-template-columns: 1fr;
  }
  .preview-col {
    display: none;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 8px 12px;
  }
  .header-game-logo {
    height: 36px;
    max-width: 150px;
  }
  .header-prof-logo-wrapper {
    width: 36px;
    height: 36px;
  }
  .sub-nav-bar {
    padding: 8px 12px;
  }
  .sub-nav-container {
    flex-direction: column;
    align-items: stretch;
  }
  .mode-tabs {
    justify-content: center;
  }
  .sub-nav-actions {
    justify-content: space-between;
  }
  .game-banner-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .banner-status-box {
    width: 100%;
    justify-content: space-around;
  }
  .footer-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .patamu-block {
    flex-direction: column;
    align-items: flex-start;
  }
}
