.tag-art-gallery {
  --tag-bg: #f6f8fc;
  --tag-panel: #ffffff;
  --tag-text: #111827;
  --tag-muted: #6b7280;
  --tag-line: #e6eaf0;
  --tag-accent: #4778ff;
  --tag-accent-soft: #e8efff;
  --tag-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  --tag-radius: 18px;
  position: relative;
  min-height: 780px;
  color: var(--tag-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
}

.tag-art-gallery * {
  box-sizing: border-box;
}

.tag-art-gallery button,
.tag-art-gallery input {
  font: inherit;
}

.tag-art-gallery button {
  cursor: pointer;
}

.tag-app {
  height: min(92vh, 860px);
  min-height: 720px;
  display: grid;
  grid-template-columns: minmax(360px, 43%) 1fr;
  background:
    radial-gradient(circle at 78% 12%, rgba(71, 120, 255, 0.08), transparent 28%),
    radial-gradient(circle at 20% 88%, rgba(255, 183, 77, 0.10), transparent 32%),
    var(--tag-bg);
  border: 1px solid rgba(230, 234, 240, 0.95);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  border-radius: 20px;
}

.tag-gallery-pane {
  height: 100%;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--tag-line);
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-width: 0;
  overflow: hidden;
}

.tag-gallery-header {
  min-height: 92px;
  padding: 0 34px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--tag-line);
}

.tag-filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 34px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tag-filter-chip {
  flex: 0 0 auto;
  border: 1px solid var(--tag-line);
  background: #fff;
  color: var(--tag-text);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.tag-filter-chip.is-active {
  background: var(--tag-accent);
  border-color: var(--tag-accent);
  color: #fff;
}

.tag-gallery-title {
  margin: 0 !important;
  font-size: clamp(24px, 2.5vw, 34px) !important;
  letter-spacing: 0.04em;
  font-weight: 800;
  color: #11183a;
  line-height: 1.2;
}

.tag-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.tag-search-input {
  width: 0;
  opacity: 0;
  border: 1px solid var(--tag-line);
  border-radius: 999px;
  padding: 10px 0;
  outline: none;
  transition: 0.22s ease;
  background: #fff;
}

.tag-search-wrap.is-open .tag-search-input {
  width: min(220px, 32vw);
  opacity: 1;
  padding: 10px 15px;
}

.tag-icon-button {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #11183a;
  display: grid;
  place-items: center;
  transition: 0.18s ease;
}

.tag-icon-button:hover,
.tag-icon-button:focus-visible {
  background: var(--tag-accent-soft);
}

.tag-gallery-content {
  min-height: 0;
  padding: 26px 28px 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tag-gallery-content::-webkit-scrollbar {
  width: 10px;
}

.tag-gallery-content::-webkit-scrollbar-thumb {
  background: #cfd7e6;
  border-radius: 999px;
  border: 3px solid #fff;
}

.tag-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 18px;
  padding-bottom: 36px;
}

.tag-tile {
  border: 2px solid transparent;
  border-radius: var(--tag-radius);
  background: #fff;
  padding: 0;
  overflow: hidden;
  text-align: left;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.tag-tile:hover,
.tag-tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--tag-shadow);
}

.tag-tile.is-selected {
  border-color: var(--tag-accent);
  box-shadow: 0 0 0 4px rgba(71, 120, 255, 0.12), var(--tag-shadow);
}

.tag-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  object-fit: cover;
  background: #f3f4f6;
}

.tag-name {
  margin: 0 !important;
  padding: 13px 14px 14px;
  font-size: clamp(14px, 1.1vw, 17px);
  line-height: 1.25;
  font-weight: 750;
  color: #11183a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.tag-viewer-pane {
  height: 100%;
  position: relative;
  display: grid;
  place-items: center;
  padding: 34px 58px;
  min-width: 0;
  overflow: hidden;
}

.tag-viewer-inner {
  width: min(910px, 100%);
  height: 100%;
  max-height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  gap: clamp(12px, 2vh, 24px);
}

.tag-art-wrap {
  min-height: 0;
  width: min(780px, 100%);
  height: 100%;
  display: grid;
  place-items: center;
}

.tag-main-art {
  width: 100%;
  max-height: min(62vh, 640px);
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.10);
  background: #fff;
}

.tag-caption {
  width: min(760px, 100%);
  text-align: center;
  display: grid;
  gap: 6px;
  padding: 0 18px 6px;
}

.tag-student {
  font-size: clamp(16px, 1.4vw, 22px);
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #11183a;
}

.tag-caption h3 {
  margin: 0 !important;
  font-size: clamp(24px, 2.7vw, 39px) !important;
  line-height: 1.15;
  letter-spacing: 0.05em;
  color: #11183a;
  font-weight: 800;
}

.tag-caption p {
  margin: 2px 0 0 !important;
  color: var(--tag-muted);
  font-size: clamp(14px, 1.22vw, 18px);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-hint {
  margin-top: 4px;
  color: #8a94a6;
  font-size: 13px;
  font-weight: 700;
}

.tag-nav {
  position: absolute;
  top: 49%;
  transform: translateY(-50%);
  width: clamp(50px, 5vw, 68px);
  height: clamp(50px, 5vw, 68px);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #11183a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.11);
  display: grid;
  place-items: center;
  transition: 0.18s ease;
  z-index: 2;
  padding: 0;
}

.tag-nav:hover,
.tag-nav:focus-visible {
  transform: translateY(-50%) scale(1.04);
  background: #fff;
}

.tag-prev {
  left: 28px;
}

.tag-next {
  right: 28px;
}

.tag-upload-fab {
  position: absolute;
  right: 26px;
  bottom: 24px;
  border: 1px solid var(--tag-line);
  background: #fff;
  color: #11183a;
  border-radius: 999px;
  padding: 12px 18px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-weight: 800;
  box-shadow: var(--tag-shadow);
  z-index: 7;
}

.tag-upload-fab:hover {
  background: var(--tag-accent-soft);
}

.tag-upload-panel {
  position: absolute;
  right: 24px;
  bottom: 86px;
  width: min(390px, calc(100% - 48px));
  background: #fff;
  border: 1px solid var(--tag-line);
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  padding: 18px;
  display: none;
  z-index: 8;
}

.tag-upload-panel.is-open {
  display: grid;
  gap: 12px;
}

.tag-upload-panel h3 {
  margin: 0 !important;
  font-size: 18px !important;
}

.tag-field {
  display: grid;
  gap: 6px;
}

.tag-field label {
  font-weight: 800;
  color: #11183a;
  font-size: 14px;
}

.tag-field input,
.tag-field select {
  width: 100%;
  border: 1px solid var(--tag-line);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.tag-field input:focus {
  border-color: var(--tag-accent);
  box-shadow: 0 0 0 4px rgba(71, 120, 255, 0.12);
}

.tag-field input:disabled {
  background: var(--tag-accent-soft);
  color: var(--tag-text);
  opacity: 1;
}

.tag-art-gallery .hidden {
  display: none !important;
}

.tag-auth-message {
  margin: 0 !important;
  font-size: 13px !important;
  color: var(--tag-muted);
  line-height: 1.5;
}

[data-role="authNotice"] {
  display: none;
  background: var(--tag-accent-soft);
  border-radius: 14px;
  padding: 14px;
}

[data-role="authNotice"].is-show {
  display: block;
}

.tag-auth-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: 8px;
  padding: 10px 16px;
}

.tag-name-locked {
  margin: 0 !important;
  font-size: 13px !important;
  color: var(--tag-accent);
  font-weight: 800;
  display: none;
}

.tag-name-locked.is-show {
  display: block;
}

.tag-reauth-link {
  display: block;
  margin-top: 6px;
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--tag-muted);
  text-decoration: underline;
  text-align: left;
  cursor: pointer;
}

.tag-primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tag-panel-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tag-plain-btn,
.tag-primary-btn {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--tag-line);
  background: #fff;
  font-weight: 800;
}

.tag-primary-btn {
  background: var(--tag-accent);
  border-color: var(--tag-accent);
  color: #fff;
}

.tag-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--tag-muted);
  padding: 40px 10px;
  border: 2px dashed var(--tag-line);
  border-radius: 18px;
}

.tag-toast {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  display: none;
  z-index: 9;
}

.tag-toast.is-show {
  display: block;
}

.tag-hidden-frame {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
}

@media (max-width: 980px) {
  .tag-art-gallery {
    min-height: 900px;
  }

  .tag-app {
    height: 900px;
    grid-template-columns: 1fr;
    grid-template-rows: 380px 520px;
  }

  .tag-gallery-pane {
    border-right: 0;
    border-bottom: 1px solid var(--tag-line);
  }

  .tag-viewer-pane {
    padding: 26px 42px 38px;
  }

  .tag-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tag-main-art {
    max-height: 330px;
  }
}

@media (max-width: 640px) {
  .tag-art-gallery {
    min-height: 900px;
  }

  .tag-app {
    height: 900px;
    grid-template-rows: 370px 530px;
    border-radius: 14px;
  }

  .tag-gallery-header {
    min-height: 82px;
    padding: 18px;
  }

  .tag-search-wrap.is-open {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .tag-search-wrap.is-open .tag-search-input {
    width: 100%;
  }

  .tag-gallery-content {
    padding: 18px;
  }

  .tag-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .tag-viewer-pane {
    padding: 22px 18px 34px;
  }

  .tag-nav {
    top: 41%;
    width: 48px;
    height: 48px;
  }

  .tag-prev {
    left: 8px;
  }

  .tag-next {
    right: 8px;
  }

  .tag-caption p {
    font-size: 14px;
    -webkit-line-clamp: 4;
  }

  .tag-upload-fab {
    right: 16px;
    bottom: 16px;
  }
}
