:root {
  --bg-dark: #f4f6f8;
  --bg-panel: #ffffff;
  --bg-panel-border: #dce1e8;
  --text-main: #171b24;
  --text-muted: #687080;
  
  /* Character & Theme Colors */
  --color-hermes: #2563eb;     /* Blue */
  --color-diana: #eab308;      /* Yellow */
  --color-apelsinka: #f97316;  /* Orange */
  --color-android: #10b981;    /* Emerald Green */
  
  --accent: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.25);
  --success: #10b981;
  --star-color: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  background: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Base screen structure */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px;
  z-index: 1;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 10;
}

/* Glassmorphism Panel style */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-panel-border);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
  max-width: 90%;
  width: 480px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Typography styles */
h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

h2 {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-main);
}

p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* Buttons */
.btn {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-main);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  padding: 14px 28px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  outline: none;
}

.btn:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  border-color: rgba(0, 0, 0, 0.1);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--color-hermes);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid #cfd6df;
  color: #334155;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #9aa6b5;
}

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 12px;
  flex-shrink: 0;
}

/* Splash Screen unique assets */
.logo-container {
  position: relative;
  height: 120px;
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-heart {
  font-size: 5rem;
  color: var(--color-hermes);
  animation: pulse-heart 2s infinite ease-in-out;
  filter: drop-shadow(0 4px 10px var(--accent-glow));
}

@keyframes pulse-heart {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Level Grid Selector */
.level-grid-container {
  max-height: 350px;
  overflow-y: auto;
  padding-right: 8px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 10px;
}

.level-card {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.level-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.level-card.completed {
  border-color: rgba(0, 179, 89, 0.3);
  background: rgba(0, 179, 89, 0.04);
}

.level-card:not(.locked):hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  transform: scale(1.04);
}

.level-card .level-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

.level-card .level-stars {
  display: flex;
  gap: 2px;
  margin-top: 6px;
}

.level-card .star {
  font-size: 0.7rem;
  color: #a0aec0;
}

.level-card.completed .star.active {
  color: var(--star-color);
}

/* Game Interface Layout */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  height: 100%;
  gap: 16px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 550px;
  padding: 0 10px;
}

.level-title-area {
  display: flex;
  flex-direction: column;
}

.level-title-area h2 {
  font-size: 1.4rem;
  font-weight: 800;
}

.level-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.game-controls-top {
  display: flex;
  gap: 10px;
}

.game-area {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1;
  background: #ffffff;
  border: 1px solid var(--bg-panel-border);
  border-radius: 8px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* HUD bottom */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 500px;
  padding: 0 10px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stat-box span {
  font-weight: 800;
  color: var(--text-main);
  margin-left: 4px;
}

/* Swipe and keyboard hint */
.control-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Modal overlays for win screen & info */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 20;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.win-panel {
  background: var(--bg-panel);
  border: 1px solid var(--bg-panel-border);
  border-radius: 24px;
  padding: 40px 30px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .win-panel {
  transform: scale(1);
}

.win-stars {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 10px 0;
}

.win-stars span {
  font-size: 2.5rem;
  color: rgba(0, 0, 0, 0.08);
  transition: color 0.5s, transform 0.5s;
}

.win-stars span.active {
  color: var(--star-color);
  transform: scale(1.2);
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.win-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--success);
}

/* Level Editor View CSS Layout */
.editor-screen {
  flex-direction: row;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
  max-width: 1200px;
  width: 95%;
  height: 90vh;
  margin: 0 auto;
}

.editor-sidebar-left {
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.editor-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.editor-sidebar-right {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.sidebar-panel {
  background: var(--bg-panel);
  border: 1px solid var(--bg-panel-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.03);
}

.sidebar-panel h3 {
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 6px;
  color: var(--text-main);
}

/* Styles for editor inputs */
.sidebar-panel input, .sidebar-panel select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-main);
  outline: none;
  font-size: 0.9rem;
}

.sidebar-panel input:focus, .sidebar-panel select:focus {
  border-color: var(--accent);
}

.tile-palette {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.palette-item {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4px;
  transition: all 0.2s;
  position: relative;
}

.palette-item.active {
  border-color: var(--accent);
  background: rgba(255, 51, 102, 0.08);
}

.palette-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.palette-item-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-bottom: 4px;
}

.palette-item-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
}

/* Custom level textarea code sharing */
.level-code-box {
  width: 100%;
  height: 80px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  color: var(--color-diana);
  font-family: monospace;
  font-size: 0.75rem;
  padding: 8px;
  resize: none;
}

/* Character Info/Guide screen in-game */
.guide-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  text-align: left;
  padding-right: 8px;
}

.guide-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 12px;
  padding: 9px 12px 9px 9px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.guide-avatar {
  width: 64px;
  height: 64px;
}

.guide-info {
  display: flex;
  flex-direction: column;
}

.guide-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.guide-ability {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

@media (max-width: 560px) {
  #modal-guide .glass-panel {
    padding: 20px;
    gap: 16px;
  }

  .guide-container {
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 58vh;
  }

  .guide-row {
    min-height: 76px;
  }
}

/* Responsive adjustments */
@media(max-width: 800px) {
  .editor-screen {
    flex-direction: column;
    height: auto;
    overflow-y: auto;
    padding-bottom: 40px;
  }
  .editor-sidebar-left, .editor-sidebar-right {
    width: 100%;
  }
  .tile-palette {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Animations */
@keyframes pulse-glowing {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 150, 199, 0.15); }
  50% { box-shadow: 0 0 25px rgba(0, 150, 199, 0.35); }
}

.pulse-glow {
  animation: pulse-glowing 2.5s infinite;
}

.win-fireworks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

/* Daily puzzle home */
#screen-splash,
#screen-level-select {
  justify-content: flex-start;
  overflow-y: auto;
  padding: 0;
}

.daily-home,
.archive-shell {
  width: min(1040px, calc(100% - 40px));
  min-height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding: 34px 0 26px;
}

.home-header,
.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid #dce1e8;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}

.brand-mark span,
.brand-mark i {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 4px solid #ffffff;
  top: 10px;
}

.brand-mark span {
  left: 2px;
  background: var(--color-hermes);
}

.brand-mark i {
  right: 2px;
  background: var(--color-diana);
}

.eyebrow {
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 5px;
}

.home-header h1 {
  font-size: 2rem;
  line-height: 1;
  margin: 0;
}

.streak-box {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 142px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #dce1e8;
  border-radius: 8px;
}

.streak-icon {
  color: #ef4444;
  font-size: 1.25rem;
}

.streak-box div {
  display: flex;
  flex-direction: column;
}

.streak-box strong {
  font-size: 1.25rem;
  line-height: 1;
}

.streak-box small {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 3px;
}

.today-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 38px 0 30px;
}

.today-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.today-heading h2 {
  font-size: 1.55rem;
  font-weight: 800;
}

.today-progress {
  width: 150px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: right;
}

.today-progress > div {
  width: 100%;
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  background: #dce1e8;
  border-radius: 3px;
}

.today-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
}

.daily-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.puzzle-card {
  position: relative;
  min-width: 0;
  min-height: 168px;
  padding: 18px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  text-align: left;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid #dce1e8;
  border-top: 4px solid #f97316;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.puzzle-card.theme-day { border-top-color: var(--color-hermes); }
.puzzle-card.theme-night { border-top-color: #8b5cf6; }

.puzzle-card:hover {
  transform: translateY(-3px);
  border-color: #b7c0cc;
  box-shadow: 0 12px 24px rgba(23, 27, 36, 0.08);
}

.puzzle-card.completed {
  background: #f6fbf8;
  border-right-color: #b8dec8;
  border-bottom-color: #b8dec8;
  border-left-color: #b8dec8;
}

.puzzle-order {
  color: #a1a8b3;
  font-size: 0.82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.puzzle-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.puzzle-copy small {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.puzzle-copy strong {
  min-width: 0;
  margin-top: 8px;
  font-size: 1.05rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.puzzle-copy em {
  margin-top: 28px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: normal;
  letter-spacing: 0;
}

.puzzle-characters {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.character-portrait {
  display: block;
  border-radius: 50%;
  flex-shrink: 0;
}

.character-mini {
  width: 24px;
  height: 24px;
}

.puzzle-result {
  min-width: 38px;
  color: #a1a8b3;
  text-align: right;
  white-space: nowrap;
}

.puzzle-result b {
  font-size: 1.3rem;
}

.puzzle-result .star {
  color: #c9ced6;
  font-size: 0.68rem;
}

.puzzle-result .star.active {
  color: var(--star-color);
}

.home-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 22px;
  border-top: 1px solid #dce1e8;
}

.home-footer .btn {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 0.92rem;
}

.home-footer .btn-icon {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: #4b5563;
}

.btn-quiet:hover {
  background: #e9edf2;
  border-color: #dce1e8;
}

.next-drop {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

/* Daily archive */
.archive-shell {
  height: 100%;
  min-height: 0;
}

.archive-header {
  flex: 0 0 auto;
}

.archive-header > div:nth-child(2) {
  flex: 1;
}

.archive-header h2 {
  font-size: 1.65rem;
  font-weight: 800;
}

.archive-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-muted);
}

.archive-score strong {
  color: var(--star-color);
  font-size: 1.4rem;
}

.archive-score span {
  font-size: 0.75rem;
}

.archive-shell .level-grid-container {
  max-height: none;
  flex: 1;
  overflow-y: auto;
  padding: 24px 8px 40px 0;
}

.archive-shell .level-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.archive-day {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 18px;
  min-height: 88px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #dce1e8;
  border-radius: 8px;
}

.archive-day.locked {
  min-height: 68px;
  background: transparent;
  border-style: dashed;
}

.archive-day-heading {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
}

.archive-day-number {
  color: #9aa3af;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.archive-day-heading > span:nth-child(2) {
  display: flex;
  flex-direction: column;
}

.archive-day-heading strong {
  font-size: 0.9rem;
}

.archive-day-heading small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.archive-day-heading b {
  color: #9aa3af;
}

.archive-day-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.puzzle-card.compact {
  min-height: 66px;
  padding: 10px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  border-top-width: 2px;
}

.puzzle-card.compact .puzzle-copy strong {
  margin-top: 3px;
  font-size: 0.78rem;
}

.puzzle-card.compact .puzzle-copy small {
  font-size: 0.61rem;
}

.puzzle-card.compact .puzzle-copy em {
  display: none;
}

/* Game refinements */
.level-kicker {
  margin-bottom: 4px;
  color: var(--color-hermes);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.game-header.glass-panel {
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(23, 27, 36, 0.06);
  text-align: left;
}

.game-area[data-theme="dawn"] { border-bottom: 4px solid var(--color-apelsinka); }
.game-area[data-theme="day"] { border-bottom: 4px solid var(--color-hermes); }
.game-area[data-theme="night"] { border-bottom: 4px solid #8b5cf6; }

.stat-button {
  cursor: pointer;
  font-family: inherit;
}

.win-panel,
.guide-row,
.sidebar-panel {
  border-radius: 8px;
}

@media (max-width: 760px) {
  .daily-home,
  .archive-shell {
    width: min(100% - 28px, 1040px);
    padding-top: 20px;
  }

  .home-header h1 {
    font-size: 1.65rem;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .brand-mark span,
  .brand-mark i {
    width: 28px;
    height: 28px;
    top: 8px;
  }

  .streak-box {
    min-width: 0;
    padding: 8px 10px;
  }

  .streak-box small {
    display: none;
  }

  .today-section {
    justify-content: flex-start;
    padding: 26px 0 20px;
  }

  .daily-levels {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .puzzle-card {
    min-height: 104px;
    padding: 14px;
  }

  .puzzle-copy em {
    margin-top: 14px;
  }

  .today-progress {
    width: 110px;
  }

  .home-footer {
    flex-wrap: wrap;
    padding-bottom: 18px;
  }

  .home-footer .btn-primary,
  .home-footer .btn-secondary {
    flex: 1 1 calc(50% - 5px);
  }

  .next-drop {
    order: 5;
    flex: 1;
    width: auto;
    margin: 2px 0 0 6px;
    text-align: right;
  }

  .archive-day {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .archive-day-levels {
    grid-template-columns: 1fr;
  }

  .archive-score span {
    display: none;
  }

  .game-header.glass-panel {
    padding: 12px 14px !important;
  }

  .level-desc {
    display: none;
  }

  .game-controls-top .btn-icon {
    width: 40px;
    height: 40px;
  }

  .hud-bottom {
    gap: 6px;
    padding: 0;
  }

  .stat-box {
    padding: 7px 9px;
    font-size: 0.76rem;
  }
}

/* Five-puzzle daily board */
.daily-home {
  width: min(760px, 100%);
}

.daily-levels {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.puzzle-card.theme-mint .puzzle-order {
  background: #10b981;
}

.puzzle-card.theme-sunset .puzzle-order {
  background: #ef4444;
}

@media (max-width: 760px) {
  #screen-splash {
    justify-content: flex-start;
    overflow-y: auto;
  }

  .daily-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .puzzle-card:nth-child(5) {
    grid-column: 1 / -1;
  }
}

/* Hypercasual single-loop UI */
body {
  background: #f4f7fb;
}

.daily-home {
  width: min(480px, 100%);
  padding: 16px 20px 22px;
}

.home-header {
  min-height: 58px;
  padding: 0 4px;
  border: 0;
}

.home-header h1 {
  font-size: 1.35rem;
  text-transform: none;
}

.brand-mark {
  width: 40px;
  height: 34px;
  flex-basis: 40px;
}

.brand-mark span,
.brand-mark i {
  width: 26px;
  height: 26px;
  top: 4px;
  border: 3px solid #f4f7fb;
}

.streak-box {
  min-width: 54px;
  min-height: 36px;
  padding: 0 10px;
  justify-content: center;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  background: #ffffff;
}

.streak-icon {
  color: #ef4444;
}

.today-section {
  justify-content: center;
  padding: 28px 0 18px;
}

.today-heading {
  align-items: flex-end;
  margin-bottom: 18px;
}

.today-heading h2 {
  font-size: 1.35rem;
}

.eyebrow {
  color: #748094;
}

.today-progress {
  width: 90px;
}

.today-progress > div {
  height: 7px;
  overflow: hidden;
  background: #dce3ec;
  border-radius: 4px;
}

.today-progress i {
  border-radius: 4px;
  background: #10b981;
}

.daily-levels {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border: 0;
}

.puzzle-card,
.puzzle-card.theme-day,
.puzzle-card.theme-night {
  position: relative;
  min-height: 164px;
  padding: 14px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: center;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  box-shadow: 0 4px 0 #dce3ec;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.puzzle-card:hover {
  background: #ffffff;
  border-color: #c8d1dd;
  box-shadow: 0 4px 0 #c8d1dd;
  transform: translateY(-1px);
}

.puzzle-card:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #c8d1dd;
}

.puzzle-card.completed {
  background: #f0fdf4;
  border-color: #9bd8b4;
  box-shadow: 0 4px 0 #9bd8b4;
}

.puzzle-order {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  color: #ffffff;
  background: #f97316;
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 800;
}

.puzzle-card.theme-day .puzzle-order {
  background: #2563eb;
}

.puzzle-card.theme-night .puzzle-order {
  background: #8b5cf6;
}

.puzzle-card.completed .puzzle-order {
  color: #ffffff;
  background: #10b981;
}

.puzzle-copy {
  align-items: center;
}

.puzzle-copy small {
  color: #748094;
  font-size: 0.62rem;
}

.puzzle-copy strong {
  margin-top: 2px;
  font-size: 0.82rem;
  line-height: 1.15;
}

.puzzle-copy em {
  margin-top: 6px;
  font-size: 0.8rem;
}

.puzzle-result {
  position: absolute;
  top: 9px;
  right: 9px;
  min-width: 0;
  line-height: 1;
}

.puzzle-result b {
  color: #a3adbb;
  font-size: 1rem;
}

.puzzle-result .star {
  display: block;
  font-size: 0.58rem;
  line-height: 0.72rem;
}

.home-footer {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 10px;
  padding-top: 18px;
}

.home-footer .btn-primary {
  width: 100%;
  min-height: 58px;
  color: #ffffff;
  background: #2563eb;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 5px 0 #1d4ed8;
  font-size: 1.08rem;
  text-transform: uppercase;
}

.home-footer .btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 5px 0 #1d4ed8;
}

.home-footer .btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #1d4ed8;
}

.home-footer .btn-icon {
  width: 46px;
  min-width: 46px;
  height: 58px;
  color: #596579;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
}

.next-drop {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  text-align: center;
  color: #748094;
}

.btn-primary,
.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.game-header.glass-panel {
  padding: 12px 14px !important;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  box-shadow: 0 3px 0 #dce3ec;
}

.game-area,
.game-area[data-theme="dawn"],
.game-area[data-theme="day"],
.game-area[data-theme="night"] {
  overflow: hidden;
  background: #ffffff;
  border: 4px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 0 #dce3ec;
}

.game-controls-top .btn-icon {
  color: #596579;
  background: #f4f7fb;
  border-color: #dce3ec;
}

.hud-bottom {
  padding: 8px 2px 0;
  border: 0;
}

.stat-box {
  padding: 7px 9px;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
}

.stat-button {
  text-decoration: none;
}

.win-panel,
.modal-overlay .glass-panel {
  border: 1px solid #dce3ec;
  border-radius: 8px;
  box-shadow: 0 6px 0 #dce3ec;
}

.win-title {
  color: #2563eb;
}

@media (max-width: 760px) {
  .daily-home {
    padding: 12px 14px 18px;
  }

  .home-header h1 {
    font-size: 1.2rem;
  }

  .today-section {
    padding: 24px 0 14px;
  }

  .daily-levels {
    gap: 7px;
  }

  .puzzle-card,
  .puzzle-card.theme-day,
  .puzzle-card.theme-night {
    min-height: 150px;
    padding: 12px 5px 10px;
  }

  .puzzle-order {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .puzzle-copy strong {
    font-size: 0.75rem;
  }

  .home-footer {
    display: grid;
    grid-template-columns: 1fr 46px;
  }

  .home-footer .btn-primary {
    min-height: 56px;
  }

  .game-header.glass-panel {
    padding: 9px 10px !important;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  .game-container {
    gap: 9px;
  }

  .game-area {
    max-width: min(430px, calc(100vh - 230px));
  }

  .control-hint {
    display: none;
  }
}

/* Minimal daily-puzzle theme */
body {
  background: #ffffff;
}

.screen {
  transition: opacity 0.16s ease;
}

.daily-home,
.archive-shell {
  width: min(640px, 100%);
  padding: 0 20px 24px;
}

.home-header,
.archive-header {
  min-height: 64px;
  padding: 0;
  border-bottom: 1px solid #d3d6da;
}

.home-header {
  position: relative;
  justify-content: center;
}

.brand-lockup {
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 30px;
  flex-basis: 34px;
}

.brand-mark span,
.brand-mark i {
  width: 22px;
  height: 22px;
  top: 4px;
  border-width: 3px;
}

.brand-mark span { left: 0; }
.brand-mark i { right: 0; }

.brand-lockup .eyebrow {
  display: none;
}

.home-header h1 {
  font-size: 1.55rem;
  line-height: 1;
  text-transform: uppercase;
}

.streak-box {
  position: absolute;
  right: 0;
  min-width: 0;
  padding: 4px 0;
  gap: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.streak-icon {
  color: #787c7e;
  font-size: 0.85rem;
}

.streak-box strong {
  font-size: 1rem;
}

.streak-box small {
  display: none;
}

.today-section {
  justify-content: flex-start;
  padding: 30px 0 22px;
}

.today-heading {
  align-items: center;
  margin-bottom: 14px;
}

.today-heading h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.eyebrow {
  margin-bottom: 4px;
  color: #787c7e;
  font-size: 0.68rem;
}

.today-progress {
  width: 106px;
  font-size: 0.7rem;
}

.today-progress > div {
  height: 4px;
  margin-top: 5px;
  background: #d3d6da;
  border-radius: 0;
}

.today-progress i {
  background: #6aaa64;
}

.daily-levels {
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid #d3d6da;
}

.puzzle-card,
.puzzle-card.theme-day,
.puzzle-card.theme-night {
  min-height: 82px;
  padding: 12px 0;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid #d3d6da;
  border-radius: 0;
  box-shadow: none;
}

.puzzle-card:hover {
  background: #f6f7f8;
  border-color: #d3d6da;
  box-shadow: none;
  transform: none;
}

.puzzle-card.completed {
  background: #ffffff;
  border-color: #d3d6da;
}

.puzzle-order {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3a3a3c;
  border: 2px solid #878a8c;
  font-size: 0.82rem;
}

.puzzle-card.completed .puzzle-order {
  color: #ffffff;
  background: #6aaa64;
  border-color: #6aaa64;
}

.puzzle-copy small {
  color: #787c7e;
  font-size: 0.65rem;
}

.puzzle-copy strong {
  margin-top: 3px;
  font-size: 1rem;
  line-height: 1.2;
}

.puzzle-copy em {
  margin-top: 5px;
  font-size: 0.76rem;
}

.puzzle-result b {
  color: #3a3a3c;
}

.puzzle-result .star {
  font-size: 0.68rem;
}

.home-footer {
  gap: 8px;
  padding-top: 14px;
  border-top: 0;
}

.btn {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid #d3d6da;
  border-radius: 3px;
  background: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: none;
}

.btn:hover {
  border-color: #878a8c;
  background: #f6f7f8;
  box-shadow: none;
  transform: none;
}

.btn-primary,
.btn-primary:hover {
  color: #ffffff;
  background: #3a3a3c;
  border-color: #3a3a3c;
  box-shadow: none;
}

.btn-secondary,
.btn-secondary:hover {
  color: #3a3a3c;
  background: #ffffff;
}

.btn-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  padding: 0;
  border-radius: 50%;
}

.btn-quiet,
.btn-quiet:hover {
  background: transparent;
  border-color: transparent;
}

.next-drop {
  color: #787c7e;
  font-size: 0.7rem;
}

/* Archive */
.archive-shell {
  max-width: 720px;
}

.archive-header h2 {
  font-size: 1.35rem;
}

.archive-header .eyebrow {
  margin-bottom: 2px;
}

.archive-shell .level-grid-container {
  padding-top: 14px;
}

.archive-shell .level-grid {
  gap: 0;
  border-top: 1px solid #d3d6da;
}

.archive-day,
.archive-day.locked {
  min-height: 72px;
  padding: 10px 0;
  grid-template-columns: 190px 1fr;
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid #d3d6da;
  border-radius: 0;
}

.archive-day.locked {
  min-height: 58px;
  color: #787c7e;
}

.archive-day-levels {
  gap: 5px;
}

.puzzle-card.compact {
  min-height: 50px;
  padding: 5px 7px;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  border: 1px solid #d3d6da;
}

.puzzle-card.compact .puzzle-order {
  width: 22px;
  height: 22px;
  border-width: 1px;
  font-size: 0.62rem;
}

/* Game */
#screen-game {
  padding: 12px 20px;
}

.game-container {
  max-width: 520px;
  gap: 10px;
}

.game-header.glass-panel {
  max-width: 500px !important;
  padding: 10px 0 12px !important;
  gap: 8px;
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid #d3d6da;
  border-radius: 0;
  box-shadow: none;
}

.level-title-area h2 {
  font-size: 1.12rem;
}

.level-kicker {
  color: #787c7e;
  font-size: 0.62rem;
}

.level-desc {
  margin-top: 3px;
  font-size: 0.75rem;
}

.game-controls-top {
  gap: 4px;
}

.game-controls-top .btn-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
}

.game-area,
.game-area[data-theme="dawn"],
.game-area[data-theme="day"],
.game-area[data-theme="night"] {
  max-width: 500px;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.hud-bottom {
  max-width: 500px;
  padding: 8px 0 0;
  border-top: 1px solid #d3d6da;
}

.stat-box {
  padding: 5px 8px;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  font-size: 0.75rem;
}

.stat-button {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.control-hint {
  color: #787c7e;
  font-size: 0.7rem;
}

/* Modals and editor */
.modal-overlay {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: none;
}

.win-panel,
.modal-overlay .glass-panel {
  border: 2px solid #3a3a3c;
  border-radius: 0;
  box-shadow: none;
}

.win-title {
  color: #3a3a3c;
  font-size: 1.5rem;
}

.guide-row,
.sidebar-panel,
.palette-item,
.level-code-box,
.sidebar-panel input,
.sidebar-panel select {
  border-radius: 3px;
  box-shadow: none;
}

@media (max-width: 760px) {
  .daily-home,
  .archive-shell {
    width: 100%;
    padding: 0 14px 18px;
  }

  .home-header {
    min-height: 58px;
  }

  .home-header h1 {
    font-size: 1.2rem;
  }

  .brand-mark {
    width: 30px;
    flex-basis: 30px;
  }

  .brand-mark span,
  .brand-mark i {
    width: 20px;
    height: 20px;
    top: 5px;
  }

  .today-section {
    padding: 22px 0 14px;
  }

  .today-heading h2 {
    font-size: 1.05rem;
  }

  .puzzle-card,
  .puzzle-card.theme-day,
  .puzzle-card.theme-night {
    min-height: 76px;
    padding: 9px 0;
  }

  .home-footer .btn-primary,
  .home-footer .btn-secondary {
    flex-basis: calc(50% - 4px);
  }

  .archive-day,
  .archive-day.locked {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .puzzle-card.compact {
    min-height: 50px;
    padding: 6px;
  }

  #screen-game {
    justify-content: flex-start;
    overflow-y: auto;
    padding: 8px 14px;
  }

  .game-container {
    height: auto;
    justify-content: flex-start;
    padding-top: 10px;
  }

  .game-header.glass-panel {
    padding: 8px 0 10px !important;
  }

  .game-controls-top .btn-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }
}

/* Final hypercasual overrides */
body {
  background: #f4f7fb;
}

.daily-home {
  width: min(480px, 100%);
  padding: 16px 20px 22px;
}

.home-header {
  min-height: 58px;
  padding: 0 4px;
  border: 0;
}

.home-header h1 {
  font-size: 1.35rem;
  text-transform: none;
}

.brand-mark {
  width: 40px;
  height: 34px;
  flex-basis: 40px;
}

.brand-mark span,
.brand-mark i {
  width: 26px;
  height: 26px;
  top: 4px;
  border: 3px solid #f4f7fb;
}

.streak-box {
  min-width: 54px;
  min-height: 36px;
  padding: 0 10px;
  justify-content: center;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  background: #ffffff;
}

.streak-icon {
  color: #ef4444;
}

.today-section {
  justify-content: center;
  padding: 28px 0 18px;
}

.today-heading {
  align-items: flex-end;
  margin-bottom: 18px;
}

.today-heading h2 {
  font-size: 1.35rem;
}

.today-progress > div {
  height: 7px;
  overflow: hidden;
  background: #dce3ec;
  border-radius: 4px;
}

.today-progress i {
  border-radius: 4px;
  background: #10b981;
}

.daily-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border: 0;
}

.puzzle-card,
.puzzle-card.theme-day,
.puzzle-card.theme-night {
  position: relative;
  min-height: 164px;
  padding: 14px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: center;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  box-shadow: 0 4px 0 #dce3ec;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.puzzle-card:hover {
  background: #ffffff;
  border-color: #c8d1dd;
  box-shadow: 0 4px 0 #c8d1dd;
  transform: translateY(-1px);
}

.puzzle-card:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #c8d1dd;
}

.puzzle-card.completed {
  background: #f0fdf4;
  border-color: #9bd8b4;
  box-shadow: 0 4px 0 #9bd8b4;
}

.puzzle-order {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  color: #ffffff;
  background: #f97316;
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
}

.puzzle-card.theme-day .puzzle-order {
  background: #2563eb;
}

.puzzle-card.theme-night .puzzle-order {
  background: #8b5cf6;
}

.puzzle-card.completed .puzzle-order {
  color: #ffffff;
  background: #10b981;
}

.puzzle-copy {
  align-items: center;
}

.puzzle-copy small {
  color: #748094;
  font-size: 0.62rem;
}

.puzzle-copy strong {
  margin-top: 2px;
  font-size: 0.82rem;
  line-height: 1.15;
}

.puzzle-copy em {
  margin-top: 6px;
  font-size: 0.8rem;
}

.puzzle-result {
  position: absolute;
  top: 9px;
  right: 9px;
  min-width: 0;
  line-height: 1;
}

.puzzle-result b {
  color: #a3adbb;
  font-size: 1rem;
}

.puzzle-result .star {
  display: block;
  font-size: 0.58rem;
  line-height: 0.72rem;
}

.home-footer {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 10px;
  padding-top: 18px;
  border: 0;
}

.home-footer .btn-primary,
.home-footer .btn-primary:hover {
  width: 100%;
  min-height: 58px;
  color: #ffffff;
  background: #2563eb;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 5px 0 #1d4ed8;
  font-size: 1.08rem;
  text-transform: uppercase;
}

.home-footer .btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #1d4ed8;
}

.home-footer .btn-icon,
.home-footer .btn-icon:hover {
  width: 46px;
  min-width: 46px;
  height: 58px;
  color: #596579;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
}

.next-drop {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  text-align: center;
  color: #748094;
}

.game-header.glass-panel {
  padding: 12px 14px !important;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  box-shadow: 0 3px 0 #dce3ec;
}

.game-area,
.game-area[data-theme="dawn"],
.game-area[data-theme="day"],
.game-area[data-theme="night"] {
  overflow: hidden;
  background: #ffffff;
  border: 4px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 0 #dce3ec;
}

.game-controls-top .btn-icon {
  color: #596579;
  background: #f4f7fb;
  border-color: #dce3ec;
}

.hud-bottom {
  padding: 8px 2px 0;
  border: 0;
}

.stat-box {
  padding: 7px 9px;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
}

.stat-button {
  text-decoration: none;
}

.win-panel,
.modal-overlay .glass-panel {
  border: 1px solid #dce3ec;
  border-radius: 8px;
  box-shadow: 0 6px 0 #dce3ec;
}

.win-title {
  color: #2563eb;
}

@media (max-width: 760px) {
  .daily-home {
    width: 100%;
    padding: 12px 14px 18px;
  }

  .today-section {
    padding: 24px 0 14px;
  }

  .daily-levels {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .puzzle-card,
  .puzzle-card.theme-day,
  .puzzle-card.theme-night {
    min-height: 150px;
    padding: 12px 5px 10px;
  }

  .puzzle-order {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .puzzle-copy strong {
    font-size: 0.75rem;
  }

  .home-footer {
    display: grid;
    grid-template-columns: 1fr 46px;
  }

  #screen-game {
    justify-content: flex-start;
    overflow-y: auto;
  }

  .game-container {
    height: auto;
    justify-content: flex-start;
  }
}

/* Final five-puzzle layout overrides */
.daily-home {
  width: min(760px, 100%);
}

.daily-levels {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.puzzle-card.theme-mint .puzzle-order {
  background: #10b981;
}

.puzzle-card.theme-sunset .puzzle-order {
  background: #ef4444;
}

@media (max-width: 760px) {
  #screen-splash {
    justify-content: flex-start;
    overflow-y: auto;
  }

  .daily-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .puzzle-card:nth-child(5) {
    grid-column: 1 / -1;
  }
}
