/* =========================
   OFFLINE GAMES FOLDER
========================= */

.offline-page,
.offline-page * {
  box-sizing: border-box;
}

.offline-page {
  min-height: 100%;
  font-family: "Fredoka", Arial, sans-serif;
  color: #000;
  display: flex;
  flex-direction: column;
  gap: 18px;
  user-select: none;
}

.offline-page input,
.offline-page textarea,
.offline-page select {
  user-select: text;
}

.offline-toolbar {
  background: #ffe9ff;
  border: 7px solid #000;
  border-radius: 28px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.24);
}

.offline-toolbar h2 {
  margin: 0 0 6px;
  font-size: clamp(30px, 4vw, 54px);
  font-weight: 900;
  line-height: 1;
}

.offline-toolbar p {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.offline-toolbar button,
.offline-filter-row button,
.offline-form-actions button,
.offline-detail-actions button {
  min-height: 54px;
  border: 6px solid #000;
  border-radius: 16px;
  padding: 0 22px;
  font-family: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.22);
}

.offline-add-btn,
.offline-save-btn {
  background: #78ff4f;
}

.offline-toolbar button:not(.offline-add-btn),
.offline-form-actions button:not(.offline-save-btn),
.offline-detail-actions button:not(.danger) {
  background: #23d8ff;
}

.offline-detail-actions button.danger,
.offline-form-actions button.danger {
  background: #ff6767;
}

.offline-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.offline-filter-row button {
  background: #fff;
  font-size: 16px;
}

.offline-filter-row button.active {
  background: #d3ff00;
  transform: translateY(-2px);
}

.offline-file-grid {
  flex: 1 1 auto;
  min-height: 0;
  background: #bff1ea;
  border: 7px solid #000;
  border-radius: 28px;
  padding: 22px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: minmax(290px, auto);
  gap: 22px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.24);
}

.offline-file-card {
  appearance: none;
  width: 100%;
  min-height: 290px;
  text-align: left;
  background: #fff;
  border: 7px solid #000;
  border-radius: 24px;
  padding: 12px;
  color: #000;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.offline-file-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.22);
}

.offline-file-top {
  position: relative;
  min-height: 120px;
  background: #fff0a8;
  border: 5px solid #000;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.offline-card-photo-stack {
  width: 100%;
  height: 120px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
}

.offline-card-photo-stack img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  background: #fff;
  border: 3px solid #000;
  border-radius: 12px;
  -webkit-user-drag: none;
  pointer-events: none;
}

.offline-card-photo-stack img:first-child:last-child {
  grid-column: 1 / -1;
}

.offline-card-empty-photo {
  font-size: 54px;
}

.offline-badge {
  display: inline-block;
  border: 4px solid #000;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.offline-file-top .offline-badge {
  position: absolute;
  right: 8px;
  top: 8px;
}

.offline-badge-shared {
  background: #23d8ff;
}

.offline-badge-personal {
  background: #d3ff00;
}

.offline-file-body h3 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.05;
}

.offline-file-body p {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.18;
}

.offline-file-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.7;
}

.offline-empty-box {
  grid-column: 1 / -1;
  align-self: start;
  background: #fff0a8;
  border: 6px solid #000;
  border-radius: 22px;
  padding: 24px;
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.offline-empty-box p {
  margin-bottom: 0;
  font-size: 17px;
}

.offline-local-note {
  margin-top: 8px !important;
  color: #7b2b00;
  font-size: 14px !important;
}

.offline-form-card,
.offline-detail-card {
  background: #bff1ea;
  border: 7px solid #000;
  border-radius: 28px;
  padding: 22px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.24);
}

.offline-form-card {
  display: grid;
  gap: 12px;
}

.offline-form-card label {
  font-size: 22px;
  font-weight: 900;
}

.offline-form-card input[type="text"],
.offline-form-card input[type="file"],
.offline-form-card textarea,
.offline-form-card select {
  width: 100%;
  background: #fff;
  border: 6px solid #000;
  border-radius: 18px;
  padding: 14px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
}

.offline-form-card textarea {
  resize: vertical;
  min-height: 220px;
  line-height: 1.25;
}

.offline-field-hint {
  margin: -4px 0 8px;
  font-size: 14px;
  font-weight: 900;
  opacity: 0.72;
}

.offline-photo-preview {
  min-height: 90px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(255, 255, 255, 0.42);
  border: 5px dashed rgba(0, 0, 0, 0.7);
  border-radius: 18px;
  padding: 12px;
}

.offline-existing-photo,
.offline-new-photo {
  width: 130px;
  height: 110px;
  position: relative;
  border: 5px solid #000;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.offline-existing-photo img,
.offline-new-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  pointer-events: none;
}

.offline-existing-photo button {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 34px;
  height: 34px;
  border: 4px solid #000;
  border-radius: 999px;
  background: #ff6767;
  font-weight: 900;
  cursor: pointer;
}

.offline-new-photo span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: #d3ff00;
  border: 3px solid #000;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
}

.offline-form-actions,
.offline-detail-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.offline-detail-card {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(320px, 1.18fr);
  gap: 22px;
  min-height: 0;
}

.offline-detail-text {
  background: #fff;
  border: 6px solid #000;
  border-radius: 22px;
  padding: 20px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal;
  overflow: auto;
  max-height: calc(100vh - 330px);
  user-select: text;
}

.offline-detail-gallery {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-content: start;
  gap: 14px;
  overflow: auto;
  max-height: calc(100vh - 330px);
}

.offline-detail-gallery figure {
  margin: 0;
  background: #fff0a8;
  border: 6px solid #000;
  border-radius: 20px;
  padding: 8px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
}

.offline-detail-gallery img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #fff;
  border: 4px solid #000;
  border-radius: 14px;
  display: block;
  -webkit-user-drag: none;
}

.offline-no-photo-detail {
  background: #fff0a8;
  border: 6px solid #000;
  border-radius: 22px;
  padding: 30px;
  display: grid;
  place-items: center;
  min-height: 220px;
  font-size: 32px;
  font-weight: 900;
}

.offline-inline-meta {
  font-weight: 900;
  margin-left: 8px;
}

.offline-desktop-folder .folder-symbol {
  font-size: 34px;
}

@media (max-width: 900px) {
  .offline-toolbar,
  .offline-detail-card {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .offline-toolbar button {
    width: 100%;
  }

  .offline-file-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }

  .offline-detail-card {
    display: flex;
  }

  .offline-detail-text,
  .offline-detail-gallery {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .offline-file-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .offline-filter-row button,
  .offline-form-actions button,
  .offline-detail-actions button {
    width: 100%;
  }
}


/* =========================
   OFFLINE GAMES PHOTO VIEWER
========================= */

.offline-detail-photo-card {
  position: relative;
}

.offline-detail-photo-btn {
  appearance: none;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  display: block;
  cursor: zoom-in;
  font-family: inherit;
  color: #000;
  position: relative;
}

.offline-detail-photo-btn img {
  pointer-events: none;
}

.offline-photo-open-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: #d3ff00;
  border: 4px solid #000;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.22);
  opacity: 0.94;
}

.offline-photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  padding: 22px;
  font-family: "Fredoka", Arial, sans-serif;
  user-select: none;
}

.offline-photo-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
}

.offline-photo-viewer-card {
  position: relative;
  width: min(1180px, 96vw);
  height: min(820px, 94vh);
  background: #bff1ea;
  border: 8px solid #000;
  border-radius: 28px;
  box-shadow: 14px 14px 0 rgba(0, 0, 0, 0.36);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.offline-photo-viewer-topbar {
  flex: 0 0 auto;
  background: #ffe9ff;
  border-bottom: 7px solid #000;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.offline-photo-viewer-topbar strong {
  display: block;
  font-size: clamp(20px, 3vw, 34px);
  font-weight: 900;
  line-height: 1.05;
}

.offline-photo-viewer-topbar span {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 900;
  opacity: 0.72;
}

.offline-photo-viewer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.offline-photo-viewer-actions button {
  min-height: 50px;
  border: 6px solid #000;
  border-radius: 16px;
  padding: 0 18px;
  background: #23d8ff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.22);
}

.offline-photo-viewer-actions button:first-child {
  background: #78ff4f;
}

.offline-photo-viewer-image-wrap {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.48) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.48) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.48) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.48) 75%),
    #dff8f6;
  background-size: 34px 34px;
  background-position: 0 0, 0 17px, 17px -17px, -17px 0;
}

.offline-photo-viewer-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  border: 6px solid #000;
  border-radius: 18px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.24);
  -webkit-user-drag: none;
}

@media (max-width: 700px) {
  .offline-photo-viewer {
    padding: 10px;
  }

  .offline-photo-viewer-card {
    width: 98vw;
    height: 96vh;
    border-radius: 20px;
  }

  .offline-photo-viewer-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .offline-photo-viewer-actions button {
    flex: 1 1 140px;
  }
}
