.page-tools {
  min-height: 100vh;
  background: linear-gradient(150deg, #f7f2ee 0%, #eef3ee 45%, #dfe8de 100%);
  padding: 5rem 0;
  display: flex;
  flex-direction: column;
}

body[data-theme="white-glass"].page-tools {
  background: linear-gradient(150deg, #f7fbff 0%, #eef6ff 45%, #e2edf9 100%);
}

body[data-theme="dark-glass"].page-tools {
  background: linear-gradient(150deg, #0f151c 0%, #121d29 45%, #102430 100%);
}

body[data-theme="cyan-portal"].page-tools {
  background: linear-gradient(150deg, #071a24 0%, #0b2734 45%, #0f3a4c 100%);
}

body[data-theme="onyx-black"].page-tools {
  background: linear-gradient(150deg, #06090d 0%, #0b1017 45%, #101723 100%);
  color: #f1f5fb;
}

body[data-theme="jungle-green"].page-tools {
  background: linear-gradient(150deg, #0a1a13 0%, #0f271c 45%, #173926 100%);
  color: #e8fff2;
}

body[data-theme="sunset-glow"].page-tools {
  background: linear-gradient(150deg, #fff7ef 0%, #ffeedd 45%, #ffd8c1 100%);
  color: #2d1e18;
}

.tools-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  padding: 0 clamp(1rem, 5vw, 2.5rem);
  padding-bottom: clamp(6.5rem, 11vh, 8.5rem);
}

.tools-shell {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.tools-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1.25rem;
  box-shadow: 0 24px 40px rgba(13, 21, 23, 0.15);
  border: 1px solid rgba(13, 21, 23, 0.08);
  gap: 2rem;
  color: #1d2730;
}

.hero-text h1 {
  margin: 0.3rem 0;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  letter-spacing: 0.22em;
  color: #1d2730;
}

.hero-text .eyebrow {
  margin: 0;
  letter-spacing: 0.5em;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--saddle, #6e4a2c);
}

.hero-text .author {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.3em;
  color: rgba(29, 39, 48, 0.78);
}

.hero-status {
  min-width: 200px;
  text-align: right;
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(13, 21, 23, 0.6);
}

.tools-grid-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tools-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tools-grid-header h2 {
  margin: 0 0 0.35rem;
  color: #1d2730;
}

.tools-grid-header p {
  margin: 0;
  color: rgba(29, 39, 48, 0.8);
}

.tool-count {
  background: #10161b;
  color: #fff;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
}

.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.6rem;
}

.tool-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.18));
  border-radius: 1rem;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(14, 20, 26, 0.16);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.6rem;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.tool-card:hover,
.tool-card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(14, 20, 26, 0.2);
  border-color: #fff;
  outline: 1px solid rgba(255, 255, 255, 0.7);
  outline-offset: 0;
}

.tool-card__image {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #f3eee6;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 0.7rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-card__image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 13, 18, 0) 55%, rgba(8, 13, 18, 0.16) 100%);
  pointer-events: none;
}

.tool-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-card__placeholder {
  color: rgba(29, 39, 48, 0.82);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
}

.tool-card__meta-panel {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  max-width: min(82%, 540px);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(13, 21, 23, 0.15);
  border-radius: 0.65rem;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  box-shadow: 0 8px 18px rgba(13, 21, 23, 0.17);
  backdrop-filter: blur(6px);
}

.tool-card__meta-panel strong {
  font-size: 1.02rem;
  line-height: 1.2;
  color: #111d28;
}

.tool-card__meta-panel span {
  font-size: 0.92rem;
  color: rgba(13, 21, 23, 0.82);
}

.tool-card__meta-panel small {
  font-size: 0.73rem;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: rgba(13, 21, 23, 0.76);
}

.tool-card__open {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(180deg, #0f1a22 0%, #091219 100%);
  color: #fff;
  width: 100%;
  border-radius: 0.7rem;
  padding: 0.82rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.7rem;
  cursor: pointer;
}

.tool-card__open:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tools-empty {
  padding: 2rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 1rem;
  border: 1px solid rgba(13, 21, 23, 0.08);
  color: #1d2730;
}

body[data-theme="white-glass"].page-tools .tools-hero,
body[data-theme="white-glass"].page-tools .tools-empty {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(94, 126, 160, 0.2);
  box-shadow: 0 20px 34px rgba(72, 99, 130, 0.13);
}

body[data-theme="dark-glass"].page-tools {
  color: #e6eef7;
}

body[data-theme="dark-glass"].page-tools .tools-hero,
body[data-theme="dark-glass"].page-tools .tools-empty {
  background: rgba(18, 29, 40, 0.88);
  border-color: rgba(128, 160, 193, 0.24);
  box-shadow: 0 24px 38px rgba(4, 10, 16, 0.4);
  color: #e6eef7;
}

body[data-theme="dark-glass"].page-tools .hero-text h1,
body[data-theme="dark-glass"].page-tools .hero-text .author,
body[data-theme="dark-glass"].page-tools .hero-status {
  color: #e6eef7;
}

body[data-theme="dark-glass"].page-tools .tools-grid-header h2,
body[data-theme="dark-glass"].page-tools .tools-grid-header p {
  color: #e6eef7;
}

body[data-theme="dark-glass"].page-tools .tool-card {
  background: linear-gradient(180deg, rgba(22, 35, 49, 0.78), rgba(15, 24, 34, 0.72));
  border-color: rgba(137, 181, 217, 0.28);
  box-shadow: 0 10px 24px rgba(3, 9, 15, 0.45);
}

body[data-theme="dark-glass"].page-tools .tool-card__image {
  background: rgba(11, 19, 27, 0.84);
  border-color: rgba(137, 181, 217, 0.2);
}

body[data-theme="dark-glass"].page-tools .tool-card__meta-panel {
  background: rgba(16, 27, 39, 0.9);
  border-color: rgba(137, 181, 217, 0.26);
}

body[data-theme="dark-glass"].page-tools .tool-card__meta-panel strong,
body[data-theme="dark-glass"].page-tools .tool-card__meta-panel span,
body[data-theme="dark-glass"].page-tools .tool-card__meta-panel small,
body[data-theme="dark-glass"].page-tools .tool-card__placeholder {
  color: #e6eef7;
}

body[data-theme="cyan-portal"].page-tools {
  color: #e8fbff;
}

body[data-theme="cyan-portal"].page-tools .tools-hero,
body[data-theme="cyan-portal"].page-tools .tools-empty {
  background: rgba(11, 34, 45, 0.88);
  border-color: rgba(0, 209, 255, 0.24);
  box-shadow: 0 24px 40px rgba(2, 12, 18, 0.45);
  color: #e8fbff;
}

body[data-theme="cyan-portal"].page-tools .hero-text h1,
body[data-theme="cyan-portal"].page-tools .hero-text .author,
body[data-theme="cyan-portal"].page-tools .hero-status {
  color: #e8fbff;
}

body[data-theme="cyan-portal"].page-tools .tools-grid-header h2,
body[data-theme="cyan-portal"].page-tools .tools-grid-header p {
  color: #e8fbff;
}

body[data-theme="cyan-portal"].page-tools .tool-card {
  background: linear-gradient(180deg, rgba(15, 46, 62, 0.78), rgba(10, 34, 47, 0.72));
  border-color: rgba(0, 209, 255, 0.28);
  box-shadow: 0 10px 24px rgba(2, 10, 14, 0.48);
}

body[data-theme="cyan-portal"].page-tools .tool-card__image {
  background: rgba(8, 28, 37, 0.84);
  border-color: rgba(0, 209, 255, 0.24);
}

body[data-theme="cyan-portal"].page-tools .tool-card__meta-panel {
  background: rgba(8, 31, 42, 0.9);
  border-color: rgba(0, 209, 255, 0.3);
}

body[data-theme="cyan-portal"].page-tools .tool-card__meta-panel strong,
body[data-theme="cyan-portal"].page-tools .tool-card__meta-panel span,
body[data-theme="cyan-portal"].page-tools .tool-card__meta-panel small,
body[data-theme="cyan-portal"].page-tools .tool-card__placeholder {
  color: #e8fbff;
}

body[data-theme="onyx-black"].page-tools .tools-hero,
body[data-theme="onyx-black"].page-tools .tools-empty {
  background: rgba(16, 25, 36, 0.9);
  border-color: rgba(164, 182, 205, 0.24);
  box-shadow: 0 24px 38px rgba(1, 4, 8, 0.48);
  color: #f1f5fb;
}

body[data-theme="onyx-black"].page-tools .hero-text h1,
body[data-theme="onyx-black"].page-tools .hero-text .author,
body[data-theme="onyx-black"].page-tools .hero-status,
body[data-theme="onyx-black"].page-tools .tools-grid-header h2,
body[data-theme="onyx-black"].page-tools .tools-grid-header p {
  color: #f1f5fb;
}

body[data-theme="onyx-black"].page-tools .tool-card {
  background: linear-gradient(180deg, rgba(20, 31, 44, 0.82), rgba(14, 22, 32, 0.76));
  border-color: rgba(164, 182, 205, 0.28);
  box-shadow: 0 10px 24px rgba(1, 4, 8, 0.5);
}

body[data-theme="onyx-black"].page-tools .tool-card__image {
  background: rgba(11, 17, 26, 0.86);
  border-color: rgba(164, 182, 205, 0.22);
}

body[data-theme="onyx-black"].page-tools .tool-card__meta-panel {
  background: rgba(15, 24, 36, 0.9);
  border-color: rgba(164, 182, 205, 0.28);
}

body[data-theme="onyx-black"].page-tools .tool-card__meta-panel strong,
body[data-theme="onyx-black"].page-tools .tool-card__meta-panel span,
body[data-theme="onyx-black"].page-tools .tool-card__meta-panel small,
body[data-theme="onyx-black"].page-tools .tool-card__placeholder {
  color: rgba(238, 245, 252, 0.9);
}

body[data-theme="jungle-green"].page-tools .tools-hero,
body[data-theme="jungle-green"].page-tools .tools-empty {
  background: rgba(14, 43, 30, 0.9);
  border-color: rgba(115, 204, 156, 0.24);
  box-shadow: 0 24px 38px rgba(2, 12, 8, 0.45);
  color: #e8fff2;
}

body[data-theme="jungle-green"].page-tools .hero-text h1,
body[data-theme="jungle-green"].page-tools .hero-text .author,
body[data-theme="jungle-green"].page-tools .hero-status,
body[data-theme="jungle-green"].page-tools .tools-grid-header h2,
body[data-theme="jungle-green"].page-tools .tools-grid-header p {
  color: #e8fff2;
}

body[data-theme="jungle-green"].page-tools .tool-card {
  background: linear-gradient(180deg, rgba(18, 53, 37, 0.8), rgba(12, 37, 26, 0.76));
  border-color: rgba(97, 224, 161, 0.3);
  box-shadow: 0 10px 24px rgba(2, 12, 8, 0.46);
}

body[data-theme="jungle-green"].page-tools .tool-card__image {
  background: rgba(10, 31, 22, 0.84);
  border-color: rgba(97, 224, 161, 0.24);
}

body[data-theme="jungle-green"].page-tools .tool-card__meta-panel {
  background: rgba(12, 36, 25, 0.9);
  border-color: rgba(97, 224, 161, 0.3);
}

body[data-theme="jungle-green"].page-tools .tool-card__meta-panel strong,
body[data-theme="jungle-green"].page-tools .tool-card__meta-panel span,
body[data-theme="jungle-green"].page-tools .tool-card__meta-panel small,
body[data-theme="jungle-green"].page-tools .tool-card__placeholder {
  color: rgba(232, 255, 242, 0.9);
}

body[data-theme="sunset-glow"].page-tools .tools-hero,
body[data-theme="sunset-glow"].page-tools .tools-empty {
  background: rgba(255, 244, 234, 0.9);
  border-color: rgba(182, 98, 58, 0.18);
  box-shadow: 0 20px 34px rgba(145, 77, 38, 0.14);
  color: #2d1e18;
}

body[data-theme="sunset-glow"].page-tools .hero-text h1,
body[data-theme="sunset-glow"].page-tools .hero-text .author,
body[data-theme="sunset-glow"].page-tools .hero-status,
body[data-theme="sunset-glow"].page-tools .tools-grid-header h2,
body[data-theme="sunset-glow"].page-tools .tools-grid-header p {
  color: #2d1e18;
}

.tool-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 14, 0.85);
  display: flex;
  flex-direction: column;
  padding: 2rem;
  gap: 1rem;
  z-index: 1000;
}

.tool-overlay__header-panel {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  backdrop-filter: blur(10px);
}

.tool-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #fff;
}

.tool-overlay__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.tool-overlay__frame {
  flex: 1;
  background: #111;
  border-radius: 1rem;
  overflow: hidden;
}

.tool-overlay__frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.embed-auth-gate {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  text-align: center;
  padding: 2rem;
  color: #f4f8fd;
}

.embed-auth-gate h3 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.embed-auth-gate p {
  margin: 0;
  color: rgba(244, 248, 253, 0.82);
}

.embed-auth-gate__actions {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.embed-auth-gate__actions button {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.68rem;
  cursor: pointer;
}

.tool-overlay__back,
.tool-overlay__fullscreen {
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.7rem;
  cursor: pointer;
}

.tool-overlay__back {
  background: #fff;
  border: none;
}

.tool-overlay__fullscreen {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

@media (max-width: 900px) {
  .tools-hero {
    flex-direction: column;
    text-align: center;
  }

  .hero-status {
    text-align: center;
  }

  .tool-overlay {
    padding: 1rem;
  }

  .tool-overlay__actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 700px) {
  .tools-page {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
    padding-bottom: max(9.75rem, calc(7rem + env(safe-area-inset-bottom)));
  }

  .tools-grid-header {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .tool-count {
    margin-left: auto;
  }

  .tool-card__meta-panel {
    left: 0.55rem;
    right: 0.55rem;
    bottom: 0.55rem;
    max-width: none;
  }

  .tool-card__open {
    letter-spacing: 0.26em;
  }
}

@media (max-width: 520px) {
  .tools-hero {
    padding: 1.2rem 1rem;
    gap: 1.2rem;
  }

  .hero-text h1 {
    font-size: clamp(1.95rem, 10vw, 2.3rem);
    letter-spacing: 0.16em;
  }

  .hero-text .author,
  .hero-status {
    letter-spacing: 0.2em;
  }

  .tool-card__meta-panel strong {
    font-size: 1.18rem;
  }

  .tool-card__meta-panel span {
    font-size: 0.78rem;
  }

  .tool-card__meta-panel small {
    font-size: 0.68rem;
    letter-spacing: 0.11em;
  }
}

@media (orientation: landscape) {
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
