:root { 
  --midnight-base: #0f172a;
  --midnight-light: #1e293b;   
  --content-bg: #F8EFE0;
  --text-main: #020617;       
  --text-muted: #475569;
  --footer-text: #e2e8f0;
  --accent-red: #dc2626;      
}

body { 
  display: flex;
  flex-direction: column;
  height: 100dvh;
  margin: 0; 
  font-family: 'Public Sans', 'Arial', sans-serif; 
  background: var(--midnight-base);
  color: var(--text-main);
  overflow: hidden;
}

.site-header {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
  background: var(--midnight-base);
  flex-shrink: 0;
  padding-top: 8px;
  padding-top: env(safe-area-inset-top, 8px);
}

.site-header a {
  display: contents;
}

.header-img {
  max-width: 140px;
  width: 40%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.content { 
  flex: 1;
  width: 100%;
  background: var(--content-bg);
  display: flex;
  flex-direction: column;
  align-items: center; 
  overflow-y: auto;
  box-shadow: inset 0 8px 10px -10px rgba(0,0,0,0.25), inset 0 -8px 10px -10px rgba(0,0,0,0.25);
}

.content.content-start {
  justify-content: flex-start;
}

.content.content-center {
  justify-content: center;
}

.inner-wrap {
  width: 100%;
  max-width: 800px;
  padding: 20px 25px;
  box-sizing: border-box;
}

.gallery-title {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.img-container {
  text-align: center;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.img-loader {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 4px solid var(--midnight-light);
  border-top-color: #e5a446;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.img-link-hidden {
  display: none;
}

.about-row {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 50px;
  text-align: left;
}

.about-row.reverse {
  flex-direction: row-reverse;
}

.about-col-img {
  flex: 0 0 30%;
  display: flex;
  justify-content: center;
  min-height: 150px;
}

.about-col-text {
  flex: 1;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-main);
  font-weight: 400;
}

.about-col-text a {
  color: var(--text-main);
  text-decoration: none;
}

.about-col-text a:hover,
.about-col-text a:focus {
  color: #e5a446;
}

.about-img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.about-header {
  margin: 20px 0 40px 0;
  color: var(--midnight-base);
  font-weight: 800;
  text-align: center;
}

.date-display {
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 600px) {
  .about-row,
  .about-row.reverse {
    flex-direction: column;
    text-align: center;
    gap: 20px;
    margin-bottom: 60px;
  }
  
  .about-col-img {
    flex: 0 0 auto;
    width: 50%;
    min-height: 100px;
  }
}

img.daily-pic {
  width: auto;
  max-width: 100%;
  max-height: 48vh;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
  object-fit: contain;
}

@media (max-width: 768px) {
  img.daily-pic {
    max-height: 40vh;
  }
}

.nav-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  margin: 15px 0;
  flex-wrap: wrap;
}

.btn-nav {
  padding: 12px 20px;
  background: var(--midnight-base);
  color: #ffffff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  height: 44px;
  box-sizing: border-box;
}

.btn-nav.icon-only {
  min-width: auto;
  padding: 0;
  font-size: 2rem;
  background: transparent;
  height: auto;
  border: none;
  filter: drop-shadow(3px 3px 5px rgba(0,0,0,0.6));
  cursor: pointer;
}

.btn-nav.icon-only:hover,
.btn-nav.icon-only:focus {
  background: transparent;
  outline: none;
}

.btn-nav:hover,
.btn-nav:focus {
  background: var(--midnight-light);
  outline: 2px solid var(--midnight-light);
  outline-offset: 2px;
}

footer {
  flex-shrink: 0;
  padding: 10px 1rem;
  background: var(--midnight-base);
  text-align: center;
  color: var(--footer-text);
  font-size: 0.75rem;
  padding-bottom: 2px;
  padding-bottom: env(safe-area-inset-bottom, 2px);
}

.footer-link {
  color: #F8EFE0;
  text-decoration: none;
  display: inline-block;
  padding: 10px;
  margin: -10px;
  font-weight: 400;
}

.footer-link:hover,
.footer-link:focus {
  color: #e5a446;
  outline: none;
}

.footer-btn-img {
  height: 55px;
  width: auto;
  margin-bottom: 2px;
  display: inline-block;
  border-radius: 50%;
}

.copyright-wrap {
  margin-top: 8px;
  padding-bottom: 2px;
}

.cat-emoji {
  cursor: pointer;
  display: inline-block;
  animation: wiggle 3s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  5%, 15% { transform: rotate(-10deg); }
  10%, 20% { transform: rotate(10deg); }
  25%, 100% { transform: rotate(0deg); }
}

.hidden {
  display: none;
}

/* Date Picker Modal */
#datePickerModal {
  display: none;
  position: fixed;
  z-index: 9998;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
}

#datePickerModal.active {
  display: flex;
}

.date-picker-container {
  background: var(--content-bg);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  max-width: 400px;
  width: 90%;
}

.date-picker-header {
  text-align: center;
  margin-bottom: 20px;
  color: var(--midnight-base);
}

.date-picker-header h2 {
  margin: 0 0 5px 0;
  font-size: 1.5rem;
}

.date-input-group {
  margin-bottom: 20px;
}

.date-input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--midnight-base);
}

.date-input-group input {
  width: 85%;
  max-width: 100%;
  padding: 10px;
  border: 2px solid var(--midnight-base);
  border-radius: 6px;
  font-size: 1rem;
  box-sizing: border-box;
  margin: 0 auto;
  display: block;
}

.date-picker-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 500px) {
  .date-picker-container {
    padding: 20px 15px;
    width: 95%;
  }
  
  .date-picker-header h2 {
    font-size: 1.3rem;
  }
  
  .date-input-group {
    margin-bottom: 15px;
  }
  
  .date-input-group input {
    padding: 8px;
    font-size: 0.9rem;
    width: 80%;
  }
  
  .date-picker-buttons .btn-nav {
    min-width: 90px;
    padding: 10px 15px;
    font-size: 0.85rem;
  }
}

/* Snake Game Modal Styles */
#snakeModal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
}

#snakeModal.active {
  display: flex;
}

.snake-container {
  background: var(--content-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  margin: auto;
}

.snake-header {
  text-align: center;
  margin-bottom: 10px;
  color: var(--midnight-base);
  flex-shrink: 0;
}

.snake-header h2 {
  margin: 0 0 5px 0;
  font-size: 1.5rem;
}

.snake-header p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.canvas-wrapper {
  margin-bottom: 10px;
  flex-shrink: 1;
  border: 3px solid var(--midnight-base);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
}

#gameCanvas {
  display: block;
  background: #fff;
  image-rendering: crisp-edges;
  width: 400px;
  height: 400px;
  max-width: 100%;
  border: none;
}

.touch-controls {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 200px;
  margin: 10px auto 5px auto;
  flex-shrink: 0;
}

.touch-btn {
  background: var(--midnight-base);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 15px;
  font-size: 1.5rem;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.touch-btn:active {
  background: var(--midnight-light);
  transform: scale(0.95);
}

.touch-btn.center {
  grid-column: 2;
  grid-row: 2;
  opacity: 0.3;
  cursor: default;
}

.touch-btn:not(.center):active {
  background: var(--accent-red);
}

.touch-btn-up {
  grid-column: 2;
  grid-row: 1;
}

.touch-btn-left {
  grid-column: 1;
  grid-row: 2;
}

.touch-btn-right {
  grid-column: 3;
  grid-row: 2;
}

.touch-btn-down {
  grid-column: 2;
  grid-row: 3;
}

@media (hover: none) and (pointer: coarse) {
  .touch-controls {
    display: grid;
  }
  
  .snake-header p {
    display: none;
  }
  
  .snake-container {
    padding: 15px 15px 10px 15px;
  }
  
  .canvas-wrapper {
    margin-bottom: 8px;
    max-width: 90vw;
    max-height: 90vw;
  }
  
  #gameCanvas {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

@media (max-width: 500px) {
  .snake-container {
    padding: 12px;
  }
  
  .snake-header h2 {
    font-size: 1.2rem;
    margin-bottom: 3px;
  }
  
  .snake-header {
    margin-bottom: 8px;
  }
  
  .canvas-wrapper {
    max-width: 85vw;
    max-height: 85vw;
  }
  
  #gameCanvas {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  
  .touch-controls {
    gap: 6px;
    max-width: 180px;
    margin: 8px auto 5px auto;
  }
  
  .touch-btn {
    padding: 12px;
    font-size: 1.3rem;
  }
  
  .game-info {
    font-size: 0.9rem;
    margin-top: 5px;
  }
  
  #gameOver p {
    font-size: 0.9rem;
  }
  
  .game-controls {
    margin-top: 8px;
    gap: 8px;
  }
  
  .game-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}

@media (max-height: 700px) {
  .snake-header h2 {
    font-size: 1.1rem;
  }
  
  .canvas-wrapper {
    max-width: 80vw;
    max-height: 80vw;
  }
  
  #gameCanvas {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  
  .touch-btn {
    padding: 10px;
    font-size: 1.2rem;
  }
  
  .game-info {
    font-size: 0.85rem;
    margin-top: 3px;
  }
  
  #gameOver p {
    font-size: 0.85rem;
  }
}

.game-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.game-btn {
  padding: 10px 20px;
  background: var(--midnight-base);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 100px;
}

.game-btn:hover,
.game-btn:focus {
  background: var(--midnight-light);
  outline: 2px solid var(--midnight-light);
  outline-offset: 2px;
}

.game-btn:active {
  transform: translateY(0);
}

.game-info {
  text-align: center;
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--midnight-base);
  flex-shrink: 0;
  min-height: 28px;
}

#gameOver {
  display: none;
  flex-shrink: 0;
}

#gameOver.active {
  display: block;
}

#gameOver p {
  color: var(--midnight-base);
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
}