#file-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 5%);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 0.4%;
  padding: 1.2%;
  pointer-events: auto;
}

.grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.08em solid transparent;
  border-radius: 0.4em;
  background: transparent;
  transition: background 0.2s, border-color 0.2s;
  min-height: 0;
  overflow: hidden;
}

.grid-cell.drag-over {
  border: 0.12em dashed rgba(24, 190, 168, 0.5);
  background: rgba(24, 190, 168, 0.04);
}

.file-thumbnail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, transform 0.15s;
  border-radius: 0.5em;
  padding: 0.4em 0.3em;
  width: 100%;
  height: 100%;
  overflow: hidden;
  margin-top: 0.8em;
}

.file-thumbnail:hover {
  background: rgba(107, 63, 191, 0.12);
  transform: translateY(-0.1em);
}

.file-icon {
  font-size: 3.2em;
  line-height: 1;
  margin-bottom: 0.2em;
}

.file-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.85em;
  text-align: center;
  word-break: break-word;
  max-width: 90%;
  line-height: 1.2;
  color: #C5AEED;
}

/* File window */
.file-window {
  position: absolute;
  width: 52%;
  height: 52%;
  background: #0D0820;
  border: 0.12em solid #271D55;
  border-radius: 0.6em;
  display: flex;
  flex-direction: column;
  z-index: 3000;
  overflow: hidden;
  box-shadow:
    0 0 2em rgba(107, 63, 191, 0.2),
    0 0.5em 2em rgba(0,0,0,0.6);
}

.file-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #070311;
  border-bottom: 0.1em solid #1E1645;
  padding: 0.5em 0.8em;
  cursor: grab;
  user-select: none;
}

.file-window-title {
  font-family: 'Cinzel', serif;
  font-size: 1.3em;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #EDE6FA;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-window-close {
  font-family: 'Space Mono', monospace;
  font-size: 1.1em;
  cursor: pointer;
  padding: 0.1em 0.4em;
  color: #9B70E0;
  border: 0.1em solid transparent;
  border-radius: 0.2em;
  transition: color 0.2s, border-color 0.2s;
}

.file-window-close:hover {
  color: #B85A18;
  border-color: #B85A18;
}

.file-window-content {
  flex: 1;
  padding: 1em;
  overflow: auto;
  font-size: 1.3em;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #C5AEED;
}

.file-window-content img {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.file-window-content-text {
  font-family: 'Space Mono', monospace;
  font-size: 1.7em;
  align-items: flex-start;
  justify-content: flex-start;
  white-space: pre-wrap;
  text-align: left;
  color: #C5AEED;
  line-height: 1.7;
}

.file-thumbnail.dragging {
  opacity: 0.35;
}
