/**
 * Game Room Portal - Main Styling
 * Version: 5.0.0
 * Compliance: Rules.md (Rule 2, Rule 3)
 */

:root {
  --portal-bg: #1e242c;
  --portal-card-bg: rgba(30, 36, 45, 0.92);
  --portal-card-border: rgba(255, 255, 255, 0.1);
  --portal-accent-purple: #8b5cf6;
  --portal-accent-blue: #38bdf8;
  --portal-accent-coral: #ff7675;
  --portal-accent-green: #10b981;
  --portal-accent-gold: #f59e0b;
}

/* Screen Management */
.app-screen {
  display: none !important;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}

.app-screen.active {
  display: flex !important;
  flex-direction: column;
}

/* ======================================================== */
/* PORTAL SCREEN (Strictly Fits in Viewport without Scroll) */
/* ======================================================== */
#screen-portal {
  background: radial-gradient(circle at 50% 10%, #252e3b 0%, #11151a 100%);
  color: #f3f4f6;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  padding: env(safe-area-inset-top, 6px) 10px env(safe-area-inset-bottom, 8px) 10px;
  box-sizing: border-box;
}

.portal-container {
  width: 100%;
  max-width: 560px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
  overflow: hidden;
}

/* PORTAL HEADER (Compact) */
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  flex-shrink: 0;
}

.portal-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-app-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.portal-title-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.portal-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  line-height: 1;
}

.portal-version-badge {
  font-size: 9px;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.4);
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.portal-version-badge:hover,
.portal-version-badge:focus-visible {
  background: rgba(139, 92, 246, 0.45);
  color: #ffffff;
  border-color: rgba(167, 139, 250, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
  outline: none;
}

.portal-version-badge::after {
  content: '▾';
  font-size: 8px;
  opacity: 0.8;
}

.portal-subtitle {
  display: none;
}

/* PORTAL OVERALL STATS BAR (Compact) */
.portal-stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 4px 8px;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

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

.portal-stat-label {
  font-size: 9px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  line-height: 1;
}

.portal-stat-value {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
  margin-top: 1px;
  line-height: 1.1;
}

.portal-stat-value.gold {
  color: var(--portal-accent-gold);
}

.portal-stat-value.green {
  color: var(--portal-accent-green);
}

/* GAME POSTERS GRID HEADER */
.portal-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.portal-grid-title {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ======================================================== */
/* 6-GAME POSTER GRID (2 cols x 3 rows, Fits Perfectly)    */
/* ======================================================== */
.portal-games-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  box-sizing: border-box;
}

@media (min-width: 620px) {
  .portal-games-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }
}

/* POSTER CARD */
.game-poster-card {
  background: var(--portal-card-bg);
  border: 1px solid var(--portal-card-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  cursor: pointer;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
}

.game-poster-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.game-poster-card:active {
  transform: scale(0.98);
}

/* POSTER BANNER / PREVIEW ART (Style A: Modern Minimal Duotone) */
.poster-art-wrapper {
  width: 100%;
  height: 44%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  pointer-events: none;
  flex-shrink: 0;
}

.poster-art-bottles {
  background: radial-gradient(circle at 50% 50%, #312e81 0%, #1e1b4b 100%);
}

.poster-art-tile-eating {
  background: radial-gradient(circle at 50% 50%, #991b1b 0%, #450a0a 100%);
}

.poster-art-kings-rescue {
  background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%);
}

.poster-art-sudoku {
  background: radial-gradient(circle at 50% 50%, #1e3a8a 0%, #0f172a 100%);
}

.poster-art-tetris {
  background: radial-gradient(circle at 50% 50%, #4c1d95 0%, #0f172a 100%);
}

.poster-art-locked {
  background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0b0f17 100%);
}

/* Badges on Art */
.poster-badge-category {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: #e2e8f0;
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  line-height: 1.1;
}

.portal-badge-beta {
  position: absolute;
  top: 5px;
  right: 5px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 4px;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
  text-transform: uppercase;
  z-index: 5;
  line-height: 1.1;
}

/* G3 Suspended Badge & Styling */
.portal-badge-suspended {
  position: absolute;
  top: 5px;
  right: 5px;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: #ffffff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 4px;
  box-shadow: 0 0 6px rgba(220, 38, 38, 0.5);
  text-transform: uppercase;
  z-index: 5;
  line-height: 1.1;
}

.game-poster-card.suspended {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(24, 28, 35, 0.9);
}

.game-poster-card.suspended .poster-art-wrapper {
  filter: grayscale(0.8) contrast(0.85);
  opacity: 0.75;
}

/* Style A: Modern Minimal Duotone Vector Artwork */
.duotone-svg {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}

/* POSTER CONTENT */
.poster-content {
  padding: 4px 8px 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-height: 0;
  gap: 2px;
}

.poster-title-row {
  display: flex;
  flex-direction: column;
}

.poster-title {
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-sub {
  font-size: 9px;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 1px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-desc {
  display: none; /* Hidden on compact view to guarantee no-scroll fit */
}

/* PROGRESS BAR COMPONENT */
.poster-progress-section {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  line-height: 1;
}

.progress-ratio {
  color: var(--portal-accent-gold);
}

.progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 100%);
  transition: width 0.4s ease;
}

.progress-fill.te-gradient {
  background: linear-gradient(90deg, #f97316 0%, #ef4444 100%);
}

.progress-fill.sudoku-gradient {
  background: linear-gradient(90deg, #38bdf8 0%, #6366f1 100%);
}

.progress-fill.tetris-gradient {
  background: linear-gradient(90deg, #a855f7 0%, #06b6d4 100%);
}

.progress-fill.kr-gradient {
  background: linear-gradient(90deg, #64748b 0%, #475569 100%);
}

.poster-btn-play {
  margin-top: 2px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 22px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.poster-btn-play.te-btn-play {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.poster-btn-play.sudoku-btn-play {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.poster-btn-play.tetris-btn-play {
  background: linear-gradient(135deg, #9333ea 0%, #0284c7 100%);
  box-shadow: 0 2px 6px rgba(147, 51, 234, 0.3);
}

.poster-btn-play.kr-btn-suspended {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.poster-btn-play:active {
  transform: scale(0.96);
}

/* COMING SOON CARD */
.game-poster-card.coming-soon {
  cursor: pointer;
  opacity: 0.65;
  border-style: dashed;
}

.game-poster-card.coming-soon:hover {
  transform: none;
  border-color: var(--portal-card-border);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.coming-soon-badge {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-start;
  margin-top: auto;
}

/* PORTAL TOAST NOTIFICATION */
.portal-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f8fafc;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 9999;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
  backdrop-filter: blur(8px);
}

.portal-toast.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* HOME BUTTON IN GAME HEADERS */
.btn-nav-home {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  height: 32px;
  padding: 0 10px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
  backdrop-filter: blur(8px);
}

.btn-nav-home svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.btn-nav-home:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.25);
}

/* ======================================================== */
/* LINE-BASED GRADIENT SVG ICONS (NO EMOJIS)                 */
/* ======================================================== */
.line-icon-title {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}

.line-icon-trophy {
  width: 48px;
  height: 48px;
  display: block;
  margin: 0 auto 6px auto;
}

.line-icon-muscle {
  width: 18px;
  height: 18px;
  display: block;
}

.line-btn-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 4px;
  flex-shrink: 0;
}

.line-icon-timer {
  width: 13px;
  height: 13px;
  stroke: #38bdf8;
  flex-shrink: 0;
}

.grid-lock-icon {
  width: 15px;
  height: 15px;
  stroke: #94a3b8;
  margin-bottom: 2px;
}

/* ======================================================== */
/* UNIFIED 3-TIER GAME HEADER (G1 - G4)                     */
/* ======================================================== */
.unified-game-header {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 8px 12px 4px 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  z-index: 20;
}

.unified-header-top-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 38px;
}

.unified-brand-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
}

.unified-brand-badge:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.unified-brand-badge:active {
  transform: scale(0.96);
}

.unified-game-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.unified-brand-title {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
  white-space: nowrap;
}

.global-version-badge {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 700;
  margin-left: 4px;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.global-version-badge:hover {
  background: rgba(59, 130, 246, 0.5);
  color: #ffffff;
  transform: scale(1.05);
}

.unified-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.unified-top-actions .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(8px);
}

.unified-top-actions .icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.unified-top-actions .icon-btn:active {
  transform: scale(0.92);
}

.unified-top-actions .icon-btn svg {
  width: 16px;
  height: 16px;
}

/* TIER 2: PROGRESS BAR */
.unified-progress-bar {
  width: 100%;
  margin: 1px 0;
  background: rgba(20, 24, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.unified-progress-bar .progress-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
}

.unified-progress-bar .progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill.sudoku-gradient {
  background: linear-gradient(90deg, #6366f1, #38bdf8);
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* TIER 3: STATS & SCOREBOARD PANEL (4 COLS) */
.unified-stats-panel {
  width: 100%;
  margin: 1px 0 2px 0;
  background: rgba(20, 24, 28, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.unified-stats-panel .score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.unified-stats-panel .score-label {
  font-size: 9.5px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.unified-stats-panel .score-value {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}

.unified-stats-panel .score-value.gold {
  color: #f59e0b;
}

.unified-stats-panel .score-value.green {
  color: #10b981;
}

.unified-stats-panel .stage-tag-val {
  display: flex;
  align-items: center;
  gap: 4px;
}

.unified-stats-panel .time-val {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ======================================================== */
/* UNIFIED LEVEL SELECT MODAL (G1 - G4)                     */
/* ======================================================== */
.unified-level-modal .modal-card {
  max-width: 480px;
  max-height: 85vh;
  max-height: 85dvh;
}

.unified-level-modal .levels-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 50vh;
  max-height: 50dvh;
  overflow-y: auto;
  padding: 8px 4px;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 440px) {
  .unified-level-modal .levels-grid {
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
  }
}

.level-grid-item {
  aspect-ratio: 1;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
}

.level-grid-item:hover:not(.locked) {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.25);
}

.level-grid-item:active:not(.locked) {
  transform: scale(0.95);
}

.level-grid-item.completed {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.level-grid-item.completed::after {
  content: "✓";
  font-size: 9px;
  position: absolute;
  bottom: 2px;
  font-weight: 900;
  color: #10b981;
}

.level-grid-item.current {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.22);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  color: #ffffff;
}

.level-grid-item.locked {
  opacity: 0.35;
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
  color: #64748b;
  cursor: not-allowed;
}

/* EX Stages in Level Modal */
.ex-levels-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.ex-levels-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.ex-divider-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 3px 10px;
  border-radius: 12px;
}

.ex-levels-status {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 8px;
}

.ex-levels-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.level-grid-item.ex-item {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  font-size: 11px;
}

.level-grid-item.ex-item.current {
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
  color: #ffffff;
}

.level-grid-item.ex-item.completed {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.level-grid-item.ex-item.completed::after {
  content: "✓";
  color: #f59e0b;
}

.level-grid-item.ex-item.locked {
  opacity: 0.35;
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
  color: #64748b;
  cursor: not-allowed;
}

/* ======================================================== */
/* RELEASE NOTES MODAL (更新履歴)                            */
/* ======================================================== */
.portal-modal-overlay {
  display: none !important;
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.portal-modal-overlay.active {
  display: flex !important;
}

.release-notes-card {
  background: #1e242c;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: popIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

.portal-modal-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #f8fafc;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: scale(1.08);
}

.release-notes-content {
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.rn-entry {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 10px 12px;
  transition: background 0.15s ease;
}

.rn-entry.latest {
  background: rgba(59, 130, 246, 0.09);
  border-color: rgba(59, 130, 246, 0.38);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.1);
}

.rn-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.rn-version-badge {
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.rn-version-badge.latest {
  background: #3b82f6;
  color: #ffffff;
}

.rn-tag {
  font-size: 9px;
  font-weight: 800;
  background: #10b981;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.rn-list {
  margin: 0;
  padding-left: 18px;
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.55;
}

.rn-list li {
  margin-bottom: 4px;
}

.rn-list li:last-child {
  margin-bottom: 0;
}
