/* Specific overrides for windows that need different max sizes or aspect ratios */
#macwrite-window,
#macpaint-window,
#nekopfp-window {
  width: clamp(300px, 90vw, 450px);
  height: clamp(250px, 85vh, 400px);
}
#alarm-clock-window {
  width: clamp(160px, 40vw, 200px);
  height: clamp(130px, 30vh, 180px);
}
#key-caps-window {
  width: clamp(350px, 90vw, 500px);
  height: clamp(150px, 40vh, 200px);
}
#about-window {
  width: clamp(280px, 70vw, 350px);
  height: clamp(150px, 40vh, 200px);
}
#hd-window,
#disk-window,
#trash-window,
#empty-folder-window,
#open-window {
  width: clamp(200px, 60vw, 300px);
  height: clamp(100px, 50vh, 400px);
}
#notepad-window {
  width: clamp(250px, 70vw, 350px);
  height: clamp(180px, 50vh, 300px);
}
#scrapbook-window {
  width: clamp(280px, 80vw, 380px);
  height: clamp(200px, 60vh, 300px);
}
#application-window,
#document-window {
  width: clamp(250px, 70vw, 350px);
  height: clamp(100px, 30vh, 180px);
}
#game-window {
  width: clamp(280px, 80vw, 350px);
  height: clamp(150px, 50vh, 250px);
}
#preferences-window,
#community-tools-window {
  width: clamp(250px, 70vw, 320px);
  height: clamp(150px, 40vh, 220px);
}

/* NEW: Neko PFP Generator window size */
#neko-pfp-generator-window {
  width: clamp(400px, 90vw, 700px);
  height: clamp(350px, 85vh, 600px);
}

/* NEW: Tic Tac Toe window size */
#tic-tac-toe-window {
  width: clamp(300px, 60vw, 400px);
  height: clamp(350px, 70vh, 450px);
}

.window-content .fs-item {
  display: flex;
  align-items: center;
  padding: 4px;
}

.window-content .fs-item img {
  width: 24px;
  height: 24px;
  margin-right: 8px;
}

/* NEW: Classic Textbox style for Feels Good PFP Generator */
.classic-textbox {
  width: 95%;
  height: 180px;
  border: 1px solid #000;
  outline: none;
  resize: none;
  font-family: "Silkscreen", monospace;
  font-size: 10px;
  padding: 5px;
  box-sizing: border-box;
  background-color: #f0f0f0;
  margin-top: 10px;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* Tic Tac Toe Styles */
#tic-tac-toe-window {
  width: clamp(300px, 60vw, 400px);
  height: clamp(350px, 70vh, 450px);
}

.tic-tac-toe-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px;
}

.tic-tac-toe-status {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--accent-blue);
    min-height: 24px;
}

.tic-tac-toe-board {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
    gap: 4px;
    margin-bottom: 20px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    padding: 8px;
    background: #f8f8f8;
}

.tic-tac-toe-cell {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-dark);
}

.tic-tac-toe-cell:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.tic-tac-toe-cell.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.tic-tac-toe-reset {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tic-tac-toe-reset:hover {
    background: #0056cc;
    transform: translateY(-1px);
}

/* MacPaint Canvas */
#macpaint-canvas {
  display: block;
  background-color: white;
  border: 1px solid black;
  cursor: crosshair;
  position: relative;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: auto;
}

/* MacPaint Toolbar Buttons */
.macpaint-tool-btn.active {
  background-color: #000;
  color: #fff;
  box-shadow: inset 1px 1px 0px rgba(0, 0, 0, 1);
  transform: translate(1px, 1px);
}

/* NEW: Neko PFP Generator Specific Styles */
#neko-pfp-generator-window .window-content {
  display: flex;
  flex-direction: column;
  padding: 10px;
  box-sizing: border-box;
}

.neko-gen-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.neko-gen-h1 {
  font-size: 16px;
  margin: 0 0 8px 0;
  color: black;
  text-align: center;
}

.neko-gen-hint {
  font-size: 10px;
  opacity: 1;
  color: black;
  margin-bottom: 10px;
  text-align: center;
}

.neko-gen-panel {
  background: #f0f0f0;
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0px rgba(0, 0, 0, 0.1);
  border-radius: 0;
  padding: 8px;
  margin-top: 0;
  margin-bottom: 10px;
}

.neko-gen-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.neko-gen-label {
  font-size: 10px;
  font-weight: bold;
  color: black;
  white-space: nowrap;
}

.neko-gen-input[type="file"],
.neko-gen-select {
  background-color: white;
  color: #000;
  border: 1px solid #000;
  border-radius: 0;
  padding: 4px 6px;
  font-family: "Silkscreen", "Chicago", sans-serif;
  font-size: 10px;
  box-shadow: inset 1px 1px 0px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  flex-shrink: 0;
  max-width: 100px;
}

.neko-gen-input[type="file"]::-webkit-file-upload-button {
  background: #e0e0e0;
  border: 1px solid #000;
  padding: 2px 5px;
  font-family: "Silkscreen", "Chicago", sans-serif;
  font-size: 9px;
  cursor: pointer;
  margin-right: 5px;
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.2);
}

.neko-gen-input[type="file"]::-webkit-file-upload-button:active {
  box-shadow: inset 1px 1px 0px rgba(0, 0, 0, 0.3);
  transform: translate(1px, 1px);
}

.neko-gen-input[type="file"] {
  padding: 0;
}

.neko-gen-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M8 12l-6-6h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  background-size: 8px;
  padding-right: 20px;
}

#neko-gen-go.dialog-button {
  padding: 4px 8px;
  font-size: 10px;
  margin-left: 5px;
}

#neko-gen-status {
  font-size: 10px;
  color: black;
  text-align: center;
  margin-top: 5px;
  margin-bottom: 5px;
}

#neko-gen-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
  align-content: flex-start;
  overflow-y: auto;
  flex-grow: 1;
}

.neko-gen-tile {
  background: #eee;
  border: 1px solid #000;
  border-radius: 0;
  padding: 4px;
  cursor: pointer;
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.neko-gen-tile:hover {
  background-color: #000;
}

.neko-gen-tile:hover canvas {
  filter: invert(1);
}

.neko-gen-tile:active {
  box-shadow: inset 1px 1px 0px rgba(0, 0, 0, 0.3);
  transform: translate(1px, 1px);
}

.neko-gen-tile canvas {
  width: 100px;
  height: 100px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  border-radius: 0;
  border: 1px solid #666;
  background-color: white;
  box-sizing: border-box;
}

/* Gallery Window Specific Styles */
#gallery-window {
  width: clamp(400px, 90vw, 800px);
  height: clamp(350px, 85vh, 600px);
}

#gallery-window .window-content {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
}

/* Override any conflicting gallery grid styles */
#gallery-window .gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 0;
  margin: 0;
}

#gallery-window .gallery-item {
  background: #f8f8f8;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

#gallery-window .gallery-item:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: var(--shadow-small);
}

#gallery-window .gallery-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px;
}

#gallery-window .gallery-item span {
  font-size: 12px;
  color: var(--text-light);
  display: block;
}

/* Gallery Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    padding: 16px 0;
}

.gallery-item {
    background: #f8f8f8;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.gallery-item:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: var(--shadow-small);
}

.gallery-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.gallery-item span {
    font-size: 12px;
    color: var(--text-light);
}

/* Mini Game Styles */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.game-score {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--accent-blue);
}

.game-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), #0056cc);
    border: none;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.game-button:hover {
    transform: scale(1.05);
}

.game-button:active {
    transform: scale(0.95);
}

/* Easter Egg Game Styles */
.easter-egg-game {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 300px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 10005;
}

.easter-egg-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.bouncing-ball {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    position: absolute;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-100px); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .easter-egg-game {
        width: 90vw;
        height: 250px;
    }
    
    #calculator-buttons button {
        height: 44px;
        font-size: 16px;
    }
}