/* ==========================================================================
   CRETAWEB 2026 — "KINETIC CORE"

   A dark stage, one sculpture of edge-lit glass blades (drawn by /assets/js/core.js),
   and an interface made of the same material: rounded glass that catches light.

   Room     near-black with a cool haze
   Light    ice from above, ember from below; the sculpture brings both
   Action   white
   Type     Geologica (Monokrom, OFL), self-hosted
   ========================================================================== */

/* 1. Fonts
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/geologica-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/geologica-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/geologica-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* 2. Tokens
   -------------------------------------------------------------------------- */
:root {
  --void: #05060a;
  --ink-1: #0a0c12;
  --ink-2: #10131c;
  --ink-3: #181c28;

  --text: #eef1f6;
  --text-2: #b0b8c8;
  --text-3: #838da0;

  --ice: #7db9ff;
  --ember: #e0895e;

  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.38);
  --glass: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.022));

  --danger: #ff9a8a;
  --ok: #8fe0b0;

  --font: 'Geologica', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, 'Hiragino Sans',
    'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --header-h: 76px;
  --gutter: clamp(20px, 5vw, 72px);
  --container-max: 1400px;
  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Names the client portal styles were written against. */
  --sea: var(--void);
  --sea-deep: var(--ink-1);
  --sea-lift: var(--ink-2);
  --sea-crest: var(--ink-3);
  --bone: var(--text);
  --bone-2: var(--text-2);
  --bone-3: var(--text-3);
  --thread: var(--ember);
  --thread-ink: var(--void);
  --thread-w: 1px;
  --rule: var(--line);
  --rule-strong: var(--line-strong);
}

/* 3. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: var(--void);
  color: var(--text);
  font-family: var(--font);
  font-size: 100%;
  font-weight: 350;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

html[lang='ja'] {
  line-height: 1.8;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--void);
  color: var(--text);
  font-size: 1.0625rem;
  overflow-x: hidden;
  overflow-x: clip;
}

/* The room: a cool haze where the sculpture stands, a trace of warmth from the floor. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(70vw 60vh at 76% 24%, rgba(52, 96, 220, 0.2), transparent 70%),
    radial-gradient(55vw 50vh at 6% 96%, rgba(224, 137, 94, 0.09), transparent 70%),
    radial-gradient(90vw 70vh at 50% 120%, rgba(30, 44, 90, 0.35), transparent 70%);
}

img,
svg,
canvas {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-color: var(--ember);
}

p,
h1,
h2,
h3,
h4 {
  overflow-wrap: break-word;
}

code {
  font-family: inherit;
  font-size: 0.95em;
  color: var(--text-2);
}

body[data-lang] code {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 3px;
}

::selection {
  background: var(--text);
  color: var(--void);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -80px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--void);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.muted {
  color: var(--text-3);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.accent {
  color: var(--ember);
}

.text-right {
  text-align: right;
}

/* 4. The sculpture layer (canvas is created by core.js)
   Order from back to front: room, portrait (1), sculpture (2), scrim (3), text (4), header (50).
   -------------------------------------------------------------------------- */
.core-canvas,
.core-glow {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.core-canvas {
  opacity: 0;
  transition: opacity 0.7s ease;
}

html.core-on .core-canvas {
  opacity: 1;
}

.core-glow {
  filter: blur(26px) saturate(1.5) brightness(1.4);
  mix-blend-mode: screen;
  opacity: 0.62;
}

.core-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 5. Glass: the surface every panel is made of
   -------------------------------------------------------------------------- */
.glass,
.portal-login-card,
.portal-dash-header,
.portal-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--glass), rgba(8, 10, 16, 0.62);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 40px 80px -48px rgba(0, 0, 0, 0.9);
}

/* A lit edge: ice where the light comes from, ember where it leaves. */
.glass::before,
.portal-login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(125, 185, 255, 0.75), rgba(125, 185, 255, 0) 28%, rgba(224, 137, 94, 0) 72%, rgba(224, 137, 94, 0.7));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: var(--edge, 0.5);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* A soft highlight that follows the pointer across the surface (set by main.js). */
.glass::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -40%), rgba(255, 255, 255, 0.09), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.glass:hover::after {
  opacity: 1;
}

.glass:hover {
  --edge: 0.9;
}

/* 6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 560;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease), box-shadow 0.25s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-sm {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn-lg {
  min-height: 56px;
  padding: 16px 30px;
  font-size: 1.0625rem;
}

.btn-xs {
  min-height: 30px;
  padding: 4px 11px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--text);
  border-color: var(--text);
  color: var(--void);
  box-shadow: 0 0 0 0 rgba(125, 185, 255, 0), 0 18px 40px -18px rgba(125, 185, 255, 0.55);
}

.btn-primary:hover {
  background: #fff;
  box-shadow: 0 0 0 5px rgba(125, 185, 255, 0.16), 0 22px 48px -16px rgba(224, 137, 94, 0.6);
}

.btn-arrow,
.portal-submit-arrow {
  transition: transform 0.25s var(--ease);
}

.btn:hover .btn-arrow,
.btn:hover .portal-submit-arrow {
  transform: translateX(4px);
}

.btn-primary[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.btn-ghost,
.btn-outline,
.btn-secondary {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.btn-ghost:hover,
.btn-outline:hover,
.btn-secondary:hover {
  border-color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.btn-text {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 0.9rem;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 0.22em;
  cursor: pointer;
}

.btn-text:hover {
  color: var(--text);
}

/* 7. Header: a floating capsule
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  padding: 12px var(--gutter) 0;
}

.site-header .header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(var(--container-max) - 2 * var(--gutter));
  height: 60px;
  padding: 0 8px 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 10, 16, 0.58);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.site-header.is-scrolled .header-inner,
.site-header.is-menu-open .header-inner {
  background: rgba(8, 10, 16, 0.86);
  border-color: rgba(255, 255, 255, 0.16);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  flex-shrink: 0;
  color: var(--text);
  text-decoration: none;
}

/* The mark: nine blades of the sculpture set like a turbine around an open ring, which also reads as a C. Painted here so the
   portal header (rendered by PHP) shows the same one. */
.brand-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg fill='none' stroke-linecap='round' stroke-width='2.7'%3E%3Cpath stroke='%237DB9FF' d='M21.5 11.4L20.7 3.2'/%3E%3Cpath stroke='%23A9CEFF' d='M17.9 9.0L12.5 2.9'/%3E%3Cpath stroke='%23D5E6FB' d='M13.5 9.2L5.6 7.3'/%3E%3Cpath stroke='%23EEF1F6' d='M10.1 11.9L2.5 14.8'/%3E%3Cpath stroke='%23EEF1F6' d='M8.8 16.0L4.2 22.8'/%3E%3Cpath stroke='%23EEF1F6' d='M10.1 20.1L10.3 28.3'/%3E%3Cpath stroke='%23F5D2C4' d='M13.5 22.8L18.4 29.4'/%3E%3Cpath stroke='%23EBB08F' d='M17.9 23.0L25.6 25.6'/%3E%3Cpath stroke='%23E0895E' d='M21.5 20.6L29.4 18.4'/%3E%3C/g%3E%3C/svg%3E")
    center / contain no-repeat;
}

.brand-mark svg {
  display: none;
}

.brand-text {
  font-size: 0.95rem;
  font-weight: 620;
  letter-spacing: 0.18em;
  line-height: 1;
}

.primary-nav {
  margin-left: auto;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.16s ease, background-color 0.16s ease;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.brand + .header-actions {
  margin-left: auto;
}

.header-cta {
  display: none;
}

/* The portal header carries six links in a fixed order. Show the same three as the site. */
body[data-lang] .nav-list li:nth-child(1),
body[data-lang] .nav-list li:nth-child(3),
body[data-lang] .nav-list li:nth-child(4) {
  display: none;
}

/* Language switcher */
.lang-switcher {
  position: relative;
}

.lang-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 560;
  letter-spacing: 0.05em;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color 0.16s ease, background-color 0.16s ease;
}

.lang-summary::-webkit-details-marker {
  display: none;
}

.lang-summary:hover,
.lang-details[open] .lang-summary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.lang-name-current {
  display: none;
}

.chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.2s var(--ease);
}

.lang-details[open] .chevron {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  z-index: 60;
  min-width: 200px;
  margin: 0;
  padding: 8px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(10, 12, 18, 0.94);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.9);
}

.lang-option {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--text-2);
  text-decoration: none;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.lang-option.is-current {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.lang-opt-code {
  width: 1.9em;
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.lang-option.is-current .lang-opt-code {
  color: var(--ember);
}

/* Client login */
.btn-login {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.btn-login:hover {
  border-color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.btn-login-icon {
  width: 15px;
  height: 15px;
  color: var(--ember);
  flex-shrink: 0;
}

.btn-login-short {
  display: none;
}

.btn-login.is-authenticated {
  border-color: var(--ember);
}

.portal-header-slot,
.portal-auth-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.portal-auth-group-mobile {
  display: grid;
  gap: 10px;
  width: 100%;
}

.portal-logout-form,
.inline-logout-form,
.portal-inline-form {
  display: inline-flex;
  margin: 0;
}

/* Menu button and drawer (below 900px) */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.menu-bars,
.menu-bars::before,
.menu-bars::after {
  display: block;
  width: 16px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.22s var(--ease), background-color 0.18s ease;
}

.menu-bars {
  position: relative;
}

.menu-bars::before,
.menu-bars::after {
  content: '';
  position: absolute;
  left: 0;
}

.menu-bars::before {
  top: -5px;
}

.menu-bars::after {
  top: 5px;
}

.menu-toggle[aria-expanded='true'] .menu-bars {
  background: transparent;
}

.menu-toggle[aria-expanded='true'] .menu-bars::before {
  transform: translateY(5px) rotate(45deg);
}

.menu-toggle[aria-expanded='true'] .menu-bars::after {
  transform: translateY(-5px) rotate(-45deg);
}

.mobile-drawer {
  position: absolute;
  top: calc(100% + 8px);
  left: var(--gutter);
  right: var(--gutter);
  max-height: calc(100vh - var(--header-h) - 24px);
  max-height: calc(100dvh - var(--header-h) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r-lg);
  background: rgba(8, 10, 16, 0.96);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: 0 40px 80px -30px #000;
}

.mobile-drawer-inner {
  display: grid;
  gap: 24px;
  padding: 14px 22px 26px;
}

.mobile-nav-list,
.mobile-meta-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mobile-nav-link {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 1.5rem;
  font-weight: 520;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.mobile-block-label {
  margin-bottom: 10px;
  color: var(--text-3);
  font-size: 0.85rem;
}

.mobile-lang-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lang-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-2);
  text-decoration: none;
}

.lang-pill.is-current {
  border-color: var(--text);
  color: var(--text);
}

.mobile-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  color: var(--text-2);
  font-size: 0.95rem;
}

.mobile-meta-list a {
  display: inline-block;
  padding: 8px 0;
}

/* 8. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin-top: calc(-1 * var(--header-h));
  overflow: hidden;
  overflow: clip;
}

/* Where the sculpture stands. On wide screens the right two thirds, bleeding off the edge. */
.hero-stage {
  position: absolute;
  top: 0;
  right: -2%;
  bottom: 0;
  width: 58%;
  cursor: grab;
}

.hero-stage:active {
  cursor: grabbing;
}

.hero-inner {
  position: relative;
  z-index: 4;
  display: flex;
  flex: 1;
  flex-direction: column;
  padding-top: calc(var(--header-h) + 24px);
  padding-bottom: clamp(20px, 3.4vh, 36px);
  pointer-events: none;
}

.hero-inner > * {
  pointer-events: auto;
}

.hero-title {
  max-width: 11em;
  margin: auto 0 0;
  font-size: clamp(2.6rem, 5.5vw, 5.4rem);
  font-weight: 620;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero-title span {
  display: block;
}

/* Many (quiet, light) against one (firm). */
.hero-title-a {
  color: var(--text-2);
  font-weight: 250;
}

html[lang='ja'] .hero-title {
  font-size: clamp(2.1rem, 4.6vw, 4.4rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.hero-sub {
  max-width: 30em;
  margin: clamp(16px, 2.6vh, 28px) 0 0;
  color: var(--text-2);
  font-size: clamp(1.02rem, 1.35vw, 1.22rem);
  line-height: 1.55;
}

.hero-actions {
  margin-top: clamp(20px, 3.4vh, 36px);
}

/* The three worlds, each with a bar that fills while the sculpture holds that form. */
.hero-worlds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px clamp(16px, 2.4vw, 36px);
  max-width: 860px;
  margin-top: auto;
  padding-top: clamp(28px, 6vh, 72px);
}

.hero-world {
  display: block;
  padding: 12px 0 10px;
  color: var(--text-3);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.3s ease;
}

.hero-world-bar {
  position: relative;
  display: block;
  height: 2px;
  margin-bottom: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.hero-world-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--ice), var(--ember));
  transform: scaleX(0);
  transform-origin: left;
}

.hero-world.is-active,
.hero-world:hover,
.hero-world:focus-visible {
  color: var(--text);
}

.hero-world.is-active .hero-world-bar::after {
  transform: scaleX(1);
  transition: transform 7s linear;
}

.hero-world.is-held .hero-world-bar::after {
  transform: scaleX(1);
  transition: transform 0.3s var(--ease);
}

.hero-hint {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(20px, 3.4vh, 36px);
  z-index: 4;
  display: none;
  margin: 0;
  padding: 10px 0;
  color: var(--text-3);
  font-size: 0.85rem;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  html.core-on .hero-hint {
    display: block;
  }
}

/* 9. Sections
   -------------------------------------------------------------------------- */
.section-title {
  max-width: 16em;
  margin: 0;
  font-size: clamp(1.9rem, 3.8vw, 3.3rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

html[lang='ja'] .section-title {
  font-size: clamp(1.6rem, 3.2vw, 2.6rem);
  line-height: 1.3;
  letter-spacing: 0;
}

.section-text {
  max-width: 34em;
  margin: 1.1em 0 0;
  color: var(--text-2);
  font-size: clamp(1.02rem, 1.3vw, 1.2rem);
  line-height: 1.6;
}

.worlds,
.founder,
.contact {
  position: relative;
  padding-block: clamp(64px, 9vw, 132px);
}

.worlds-copy,
.founder-copy,
.contact-copy,
.console,
.legal-wrap,
.gate-wrap {
  position: relative;
  z-index: 4;
}

/* 10. Worlds
   -------------------------------------------------------------------------- */
.worlds-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: start;
  gap: clamp(32px, 5vw, 88px);
}

.worlds-stage {
  position: sticky;
  top: 13vh;
  height: 74vh;
  cursor: grab;
}

.world-stage {
  display: none;
}

.world-list {
  display: grid;
  gap: 14px;
  margin-top: clamp(28px, 4vw, 48px);
}

.world {
  --edge: 0.22;
}

.world[open] {
  --edge: 0.95;
}

.world-summary {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 20px;
  padding: clamp(20px, 2.4vw, 30px) clamp(20px, 2.6vw, 32px);
  border-radius: inherit;
  cursor: pointer;
  list-style: none;
}

.world-summary::-webkit-details-marker {
  display: none;
}

.world-title {
  grid-column: 1;
  margin: 0;
  font-size: clamp(1.3rem, 2.3vw, 1.9rem);
  font-weight: 580;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

html[lang='ja'] .world-title {
  line-height: 1.35;
  letter-spacing: 0;
}

.world-line {
  grid-column: 1;
  max-width: 38em;
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1.5;
}

.world-toggle {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.35s var(--ease);
}

.world-toggle::before,
.world-toggle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 1.5px;
  margin: -0.75px 0 0 -7px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.35s var(--ease), background-color 0.2s ease;
}

.world-toggle::after {
  transform: rotate(90deg);
}

.world[open] .world-toggle {
  border-color: var(--text);
  background: var(--text);
  transform: rotate(180deg);
}

.world[open] .world-toggle::before,
.world[open] .world-toggle::after {
  background: var(--void);
}

.world[open] .world-toggle::after {
  transform: rotate(0deg);
}

.world-summary:focus-visible {
  outline-offset: -4px;
}

.world-body {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.world-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 22px 36px;
  margin: 0;
  padding: 6px clamp(20px, 2.6vw, 32px) clamp(24px, 2.8vw, 34px);
}

.world-details > div {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.world-details dt {
  font-weight: 560;
}

.world-details dd {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 0.98rem;
  line-height: 1.5;
}

/* 11. Founder: the portrait at the centre of the ring
   -------------------------------------------------------------------------- */
.founder-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(32px, 5vw, 88px);
}

.founder-visual {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1;
  margin-inline: auto;
}

.founder-orbit {
  position: absolute;
  inset: 0;
}

.portrait {
  position: absolute;
  inset: 20%;
  z-index: 1;
  display: block;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ink-2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 0 90px -10px rgba(80, 130, 255, 0.45), 0 40px 80px -30px rgba(224, 137, 94, 0.35);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  filter: brightness(1.32) contrast(1.02);
}

/* The two lights of the scene fall on the photograph as well. */
.portrait::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(125, 185, 255, 0.34), rgba(125, 185, 255, 0) 45%, rgba(224, 137, 94, 0) 55%, rgba(224, 137, 94, 0.3));
  mix-blend-mode: screen;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 18px clamp(28px, 4vw, 56px);
  margin: clamp(28px, 4vw, 44px) 0 0;
}

.facts dt {
  color: var(--text-3);
  font-size: 0.9rem;
}

.facts dd {
  margin: 2px 0 0;
  font-size: 1.15rem;
  font-weight: 540;
}

/* 12. Contact console
   -------------------------------------------------------------------------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  align-items: start;
  gap: clamp(32px, 5vw, 88px);
}

.direct {
  margin-top: clamp(32px, 5vw, 56px);
}

.direct-label {
  margin: 0 0 8px;
  color: var(--text-3);
  font-size: 0.95rem;
}

.direct-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: clamp(1.1rem, 1.6vw, 1.4rem);
  font-weight: 520;
}

.direct-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 12px;
}

.direct-list a {
  display: inline-block;
  padding: 7px 0;
}

.console {
  --edge: 0.7;
  padding: clamp(20px, 2.8vw, 36px);
}

.console > * {
  position: relative;
  z-index: 1;
}

.contact-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 22px;
}

.mode-bar-title {
  font-size: 1.15rem;
  font-weight: 560;
}

.mode-switch {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
}

.mode-btn {
  min-height: 38px;
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mode-btn.is-active {
  background: var(--text);
  color: var(--void);
  font-weight: 560;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label,
.portal-field-label {
  display: block;
  margin: 0 0 7px 6px;
  color: var(--text-2);
  font-size: 0.88rem;
}

.form-field input,
.form-field select,
.form-field textarea,
.chat-composer input,
.chat-composer select,
.chat-composer textarea,
.form-input,
.form-textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 13px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(3, 4, 8, 0.55);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-field textarea,
.chat-composer textarea,
.form-textarea {
  min-height: 136px;
  border-radius: 20px;
  resize: vertical;
}

.form-field select,
.chat-composer select {
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23EEF1F6' stroke-width='1.6'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 12px;
}

.form-field select option,
.chat-composer select option {
  background: var(--ink-1);
  color: var(--text);
}

.form-field input:hover,
.form-field select:hover,
.form-field textarea:hover,
.chat-composer input:hover,
.chat-composer select:hover,
.chat-composer textarea:hover,
.form-input:hover,
.form-textarea:hover {
  border-color: rgba(255, 255, 255, 0.6);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.chat-composer input:focus,
.chat-composer select:focus,
.chat-composer textarea:focus,
.form-input:focus,
.form-textarea:focus {
  border-color: var(--ice);
  outline: none;
  background-color: rgba(3, 4, 8, 0.8);
  box-shadow: 0 0 0 4px rgba(125, 185, 255, 0.2), 0 12px 40px -16px rgba(125, 185, 255, 0.5);
}

::placeholder {
  color: var(--text-3);
  opacity: 1;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-top: 6px;
}

.form-privacy {
  flex: 1 1 240px;
  max-width: 30em;
  margin: 0;
  color: var(--text-3);
  font-size: 0.88rem;
}

.noscript-banner {
  margin: 0 0 18px;
  padding: 14px 18px;
  border: 1px solid var(--ember);
  border-radius: 16px;
}

.form-status {
  margin: 18px 0 0;
  padding: 14px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  font-size: 0.98rem;
}

.form-status.is-success {
  border-color: var(--ok);
  color: var(--ok);
}

.form-status.is-error {
  border-color: var(--danger);
  color: var(--danger);
}

/* Message view */
.chat-header-title {
  font-size: 1.05rem;
  font-weight: 560;
}

.chat-header-status {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 0.88rem;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  margin: 18px 0;
  overflow-y: auto;
}

.chat-msg {
  max-width: min(100%, 34em);
}

.chat-msg-user {
  align-self: flex-end;
  text-align: right;
}

.chat-bubble {
  display: inline-block;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 20px 20px 20px 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  font-size: 0.98rem;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-msg-user .chat-bubble {
  border-radius: 20px 20px 6px 20px;
  border-color: transparent;
  background: var(--text);
  color: var(--void);
}

.chat-meta {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 0.82rem;
}

.chat-inputs-top {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.chat-input-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-input-main textarea {
  min-height: 92px;
}

.chat-input-main .btn {
  min-height: 52px;
}

/* 13. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 4;
  padding: clamp(44px, 6vw, 80px) 0 28px;
  border-top: 1px solid var(--line);
  background: rgba(5, 6, 10, 0.86);
  color: var(--text-2);
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.8fr 1.4fr;
  gap: 36px clamp(24px, 4vw, 64px);
}

.footer-tagline {
  max-width: 22em;
  margin: 16px 0 0;
  color: var(--text-3);
}

.footer-heading {
  margin: 0 0 12px;
  color: var(--text-3);
  font-size: 0.9rem;
  font-weight: 400;
}

.footer-links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-block;
  padding: 5px 0;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

.operator-address {
  font-style: normal;
  line-height: 1.7;
}

.operator-address strong {
  color: var(--text);
  font-weight: 560;
}

.operator-hosts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 14px 0 0;
}

.operator-hosts-label {
  width: 100%;
  color: var(--text-3);
  font-size: 0.9rem;
}

.operator-link {
  margin: 12px 0 0;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-top: clamp(32px, 4.5vw, 56px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 0.9rem;
}

.footer-langs,
.footer-legal-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.footer-lang-link,
.footer-legal-inline a {
  display: inline-block;
  padding: 6px 0;
  text-decoration: none;
}

.footer-lang-link:hover,
.footer-legal-inline a:hover,
.footer-lang-link.is-current {
  color: var(--text);
}

.footer-legal-inline span[aria-hidden='true'] {
  display: none;
}

/* 14. Legal pages
   -------------------------------------------------------------------------- */
.legal-body {
  padding-top: clamp(40px, 6vw, 88px);
  padding-bottom: clamp(64px, 9vw, 120px);
}

.breadcrumb {
  margin-bottom: clamp(24px, 3.4vw, 40px);
  color: var(--text-3);
  font-size: 0.95rem;
}

.legal-title {
  max-width: 16em;
  margin: 0;
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

html[lang='ja'] .legal-title {
  line-height: 1.3;
  letter-spacing: 0;
}

.legal-intro {
  max-width: 44em;
  margin: 1.2em 0 0;
  color: var(--text-2);
  font-size: 1.12rem;
}

.legal-draft-banner {
  max-width: 48em;
  margin-top: 26px;
  padding: 14px 18px;
  border: 1px dashed var(--ember);
  border-radius: 16px;
  color: var(--text-2);
  font-size: 0.95rem;
}

.legal-cards {
  max-width: 48em;
  margin: clamp(32px, 4.5vw, 56px) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: legal;
}

.legal-card {
  padding: 26px 0;
  border-top: 1px solid var(--line);
}

.legal-card h2 {
  margin: 0 0 12px;
  font-size: 1.3rem;
  font-weight: 580;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.legal-cards-numbered .legal-card {
  counter-increment: legal;
}

.legal-cards-numbered .legal-card h2::before {
  content: counter(legal) '. ';
  color: var(--text-3);
}

.legal-card p {
  margin: 0 0 12px;
  color: var(--text-2);
}

.legal-card p:last-child {
  margin-bottom: 0;
}

.legal-card-highlight {
  padding: 26px clamp(18px, 3vw, 28px);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--glass);
}

.legal-card-highlight + .legal-card {
  border-top: 0;
}

.legal-dl {
  margin: 0;
}

.legal-dl > div {
  display: grid;
  grid-template-columns: minmax(120px, 13em) minmax(0, 1fr);
  gap: 4px 20px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.legal-dl > div:first-child {
  border-top: 0;
}

.legal-dl dt {
  color: var(--text-3);
}

.legal-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.legal-contact-list,
.host-list {
  margin: 12px 0;
  padding-left: 1.2em;
  color: var(--text-2);
}

.legal-contact-list li,
.host-list li {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.legal-meta-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 32px 0 0;
  color: var(--text-3);
  font-size: 0.9rem;
}

/* 15. Standalone pages: language gate at /, 404, server node
   -------------------------------------------------------------------------- */
.page-gate {
  display: flex;
  flex-direction: column;
}

.gate {
  flex: 1;
  padding-bottom: clamp(48px, 7vw, 96px);
}

.gate-head {
  padding-top: clamp(28px, 6vh, 72px);
  padding-bottom: clamp(22px, 3vw, 36px);
}

.gate-code {
  margin: 0 0 12px;
  color: var(--text-3);
}

.gate-title {
  margin: 0;
  font-size: clamp(2.1rem, 5.4vw, 4.2rem);
  font-weight: 620;
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.gate-title span {
  display: block;
}

.gate-lead {
  max-width: 40em;
  margin: 1em 0 0;
  color: var(--text-2);
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
}

.gate-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 22px;
  margin: 16px 0 0;
  color: var(--text-2);
}

.gate-contact a {
  display: inline-block;
  padding: 6px 0;
}

.gate-langs {
  display: grid;
  gap: 10px;
  max-width: 880px;
}

.gate-lang {
  --edge: 0.25;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 28px;
  padding: 16px 26px;
  border-radius: var(--r-md);
  text-decoration: none;
}

.gate-lang > * {
  position: relative;
  z-index: 1;
}

.gate-lang-name {
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  font-weight: 580;
  letter-spacing: -0.025em;
}

.gate-lang-cta {
  color: var(--text-3);
  font-size: 0.98rem;
}

.gate-lang:focus-visible {
  outline-offset: 2px;
}

.gate-foot {
  padding-top: clamp(36px, 5vw, 64px);
}

.gate-operator h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  font-weight: 580;
}

.gate-operator address {
  font-style: normal;
  color: var(--text-2);
  line-height: 1.7;
}

.gate-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin: 16px 0 0;
}

.gate-legal-links a {
  display: inline-block;
  padding: 6px 0;
}

.gate-foot .legal-card-highlight {
  max-width: 48em;
  margin-bottom: 28px;
}

/* 16. Client portal (markup comes from PHP and is not changed)
   -------------------------------------------------------------------------- */
.section {
  padding: clamp(40px, 6vw, 72px) 0;
}

.section-kicker {
  display: block;
  color: var(--bone-3);
  font-size: 0.9rem;
}

.portal-section {
  min-height: calc(100vh - 220px);
  padding: 32px 0 84px;
}

.portal-login-section {
  display: flex;
  align-items: center;
  min-height: calc(100vh - 220px);
  padding: 40px 0 64px;
}

.portal-login-shell {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

/* The same turn of the meander that wraps the claim wraps the sign-in. */
.portal-login-card {
  position: relative;
  padding: 34px 32px 26px;
  background: var(--sea-deep);
  border: var(--thread-w) solid var(--thread);
  border-left: 0;
  box-shadow: inset var(--thread-w) 0 0 var(--rule);
}

.portal-login-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--bone-3);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.portal-status-dot,
.portal-status-line .dot,
.portal-meta-val--active .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

.portal-card-head {
  margin-bottom: 22px;
}

.portal-login-title {
  margin: 0 0 8px;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.portal-login-subtitle {
  margin: 0;
  color: var(--bone-2);
  font-size: 1rem;
  line-height: 1.5;
}

.portal-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--rule-strong);
  font-size: 0.92rem;
  line-height: 1.48;
}

.portal-alert--error,
.portal-alert-error {
  border-color: var(--danger);
  color: var(--danger);
}

.portal-alert--info,
.portal-alert-info {
  border-color: var(--thread);
  color: var(--bone);
}

.portal-alert-dot {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.portal-field-group {
  margin-bottom: 18px;
}

.portal-field-group--compact {
  margin-bottom: 16px;
}

.portal-key-input-wrap {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 6px 0 13px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--sea);
  transition: border-color 0.16s ease;
}

.portal-key-input-wrap:focus-within {
  border-color: var(--thread);
  outline: 2px solid var(--thread);
}

.portal-key-input,
.portal-key-input:hover,
.portal-key-input:focus {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0 8px 0 0;
  border: 0;
  background: transparent;
  color: var(--bone);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  letter-spacing: 0.01em;
  outline: none;
}

.portal-key-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.portal-key-btn {
  height: 38px;
  padding: 0 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--bone-2);
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.portal-key-btn:hover {
  border-color: var(--thread);
  color: var(--bone);
}

.portal-pin-input {
  min-height: 46px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.portal-form-actions {
  margin-top: 20px;
}

.portal-submit-btn {
  width: 100%;
  min-height: 52px;
  gap: 8px;
}

.portal-submit-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.16s ease;
}

.portal-submit-btn:hover .portal-submit-arrow {
  transform: translateX(3px);
}

.portal-security-footnote {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  color: var(--bone-3);
  font-size: 0.8rem;
}

.portal-shield-icon {
  width: 14px;
  height: 14px;
  color: var(--thread);
  flex-shrink: 0;
}

.portal-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.9rem;
}

.portal-foot-link {
  display: inline-block;
  padding: 6px 0;
  color: var(--bone-2);
  text-decoration: none;
}

.portal-foot-link:hover {
  color: var(--thread);
}

/* The portal footer is a single line; it needs none of the room the site footer takes,
   and it sits at the bottom of the window even when the page is short. */
body[data-lang] {
  display: flex;
  flex-direction: column;
}

body[data-lang] > main {
  flex: 1;
}

body[data-lang] .site-footer {
  padding-top: 0;
}

body[data-lang] .footer-bottom {
  margin-top: 0;
  border-top: 0;
}

.footer-legal-inline span[aria-hidden='true'] {
  display: none;
}

/* Narrow phones: the key field gets the full width, its two helpers sit underneath. */
@media (max-width: 480px) {
  .portal-key-input-wrap {
    flex-wrap: wrap;
    height: auto;
    padding: 4px 6px 6px 13px;
  }

  .portal-key-input,
  .portal-key-input:hover,
  .portal-key-input:focus {
    flex: 1 0 100%;
    height: 44px;
  }

  .portal-key-actions {
    width: 100%;
    margin-left: -7px;
  }

  .portal-key-btn {
    flex: 1;
    height: 40px;
  }
}

/* Dashboard and admin console */
.portal-dashboard {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.portal-dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 26px 28px;
  background: var(--sea-deep);
  border: var(--thread-w) solid var(--thread);
  border-left: 0;
}

.portal-dash-welcome {
  min-width: 0;
  max-width: 100%;
}

.portal-title {
  margin: 8px 0 4px;
  font-size: clamp(1.65rem, 3.1vw, 2.35rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.022em;
  overflow-wrap: anywhere;
}

.portal-subtitle {
  margin: 6px 0 0;
  color: var(--bone-2);
  font-size: 0.95rem;
  line-height: 1.45;
}

.portal-dash-actions,
.portal-panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-contact-actions .btn {
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.portal-contact-label {
  color: var(--text-3);
  font-weight: 500;
  margin-right: 4px;
}

.portal-meta-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.portal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.portal-meta-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 14px 16px;
  background: var(--sea-lift);
  border: 1px solid var(--rule);
}

.portal-meta-card--workspace .portal-workspace-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.portal-status-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.portal-status-line--active,
.portal-meta-val--active {
  color: var(--ok);
}

.portal-meta-val--active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.portal-workspace-path {
  display: block;
  color: var(--thread);
  font-family: var(--font-mono);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-all;
}

.portal-meta-label {
  color: var(--bone-3);
  font-size: 0.8rem;
}

.portal-meta-val {
  color: var(--bone);
  font-size: 0.92rem;
  word-break: break-word;
}

.portal-panel {
  padding: 24px 26px;
  background: var(--sea-lift);
  border: 1px solid var(--rule);
}

.portal-panel-title {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 640;
}

.portal-panel-sub {
  margin: 0 0 16px;
  color: var(--bone-2);
  font-size: 0.9rem;
}

.portal-panel-body {
  margin: 0 0 16px;
  color: var(--bone-2);
  font-size: 0.95rem;
}

.portal-panels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}

.portal-inquiry-detail {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--sea);
  border: 1px solid var(--rule);
}

.portal-inquiry-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px 16px;
  font-size: 0.9rem;
}

.portal-inquiry-pre {
  max-height: 380px;
  margin: 8px 0 14px;
  padding: 14px;
  overflow-y: auto;
  background: var(--sea-deep);
  border: 1px solid var(--rule);
  color: var(--bone);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Login method segmented tabs (Access Key vs. Client Name + Password) */
.portal-login-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.portal-login-tab {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.portal-login-tab:hover {
  color: var(--text);
}

.portal-login-tab.is-active {
  background: rgba(69, 227, 232, 0.12);
  border-color: rgba(69, 227, 232, 0.35);
  color: var(--text);
}

.portal-login-panel[hidden] {
  display: none;
}

/* Admin client password status & inline editor */
.portal-pw-meta {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.portal-action-group--password {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

.portal-pw-details {
  display: inline-block;
  max-width: 100%;
}

.portal-pw-details > summary {
  list-style: none;
  cursor: pointer;
}

.portal-pw-details > summary::-webkit-details-marker {
  display: none;
}

.portal-pw-form {
  margin-top: 8px;
  padding: 12px;
  min-width: 240px;
  max-width: 310px;
  background: rgba(8, 12, 18, 0.9);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-pw-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.portal-key-input-wrap--sm {
  height: 38px;
  padding: 2px 4px 2px 10px;
}

.portal-key-input-wrap--sm .portal-key-input {
  font-size: 0.86rem;
}

.portal-key-input-wrap--sm .portal-key-btn {
  height: 30px;
  padding: 0 8px;
  font-size: 0.76rem;
}

.portal-pw-warn {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 181, 71, 0.45);
  background: rgba(255, 181, 71, 0.09);
  color: #ffd38a;
  font-size: 0.78rem;
  line-height: 1.4;
}

.portal-pw-err {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.1);
  color: #ffb4b4;
  font-size: 0.78rem;
  line-height: 1.4;
}

.portal-pw-form-actions {
  display: flex;
  justify-content: flex-end;
}

/* File vault */
.portal-vault-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.portal-vault-stats-pill {
  padding: 5px 12px;
  border: 1px solid var(--rule-strong);
  color: var(--bone-2);
  font-size: 0.82rem;
}

.portal-vault-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--sea-deep);
  border: 1px solid var(--rule);
}

.portal-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.86rem;
}

.portal-bc-link {
  color: var(--thread);
}

.portal-bc-sep {
  color: var(--bone-3);
}

.portal-bc-current {
  color: var(--bone);
  font-weight: 600;
}

.portal-vault-search {
  min-width: min(100%, 220px);
  margin: 0;
}

.portal-search-input {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 0.88rem;
}

.portal-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.portal-vault-table,
.portal-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.portal-vault-table th,
.portal-admin-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--bone-3);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.portal-vault-table td,
.portal-admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

.portal-vault-table tr:hover td,
.portal-admin-table tr:hover td {
  background: rgba(244, 237, 227, 0.03);
}

.portal-vault-item-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--bone);
  font-weight: 600;
  text-decoration: none;
}

.portal-vault-item-link:hover {
  color: var(--thread);
}

.portal-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--rule-strong);
  color: var(--bone-2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
}

.portal-file-icon--folder {
  border-color: var(--thread);
  color: var(--thread);
}

.portal-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--rule);
  color: var(--bone-2);
  font-size: 0.76rem;
}

.portal-type-badge--folder {
  border-color: var(--thread);
  color: var(--thread);
}

.portal-vault-cell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.portal-vault-empty {
  padding: 36px 20px;
  background: var(--sea-deep);
  border: 1px dashed var(--rule-strong);
  text-align: center;
}

.portal-vault-empty-icon {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 12px;
  border: 1px solid var(--rule-strong);
  color: var(--bone-2);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.portal-vault-empty-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.portal-vault-empty-text {
  max-width: 520px;
  margin: 0 auto;
  color: var(--bone-2);
  font-size: 0.92rem;
}

.portal-direct-url-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  padding: 11px 14px;
  border: 1px solid var(--rule);
  color: var(--bone-2);
  font-size: 0.86rem;
}

.portal-direct-url-bar strong {
  color: var(--bone);
}

.portal-workspace-notes {
  padding: 14px 16px;
  background: var(--sea-deep);
  border: 1px solid var(--rule);
  color: var(--bone-2);
  font-size: 0.92rem;
}

/* Admin */
.portal-secret-banner {
  padding: 20px 22px;
  background: var(--sea-deep);
  border: var(--thread-w) solid var(--thread);
}

.portal-secret-kicker {
  color: var(--thread);
  font-size: 0.85rem;
}

.portal-secret-title {
  margin: 4px 0 6px;
  color: var(--bone);
  font-size: 1.15rem;
}

.portal-secret-warn {
  margin: 0 0 12px;
  color: var(--bone-2);
  font-size: 0.9rem;
}

.portal-secret-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--sea);
  border: 1px solid var(--rule-strong);
}

.portal-secret-code {
  color: var(--thread);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  word-break: break-all;
}

.portal-client-cell-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.portal-role-tag {
  padding: 1px 6px;
  border: 1px solid var(--rule-strong);
  color: var(--bone-2);
  font-size: 0.7rem;
}

.portal-badge {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--rule-strong);
  font-size: 0.76rem;
  font-weight: 600;
}

.portal-badge--active {
  border-color: var(--ok);
  color: var(--ok);
}

.portal-badge--warn {
  border-color: var(--thread);
  color: var(--thread);
}

.portal-badge--danger {
  border-color: var(--danger);
  color: var(--danger);
}

.portal-admin-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 280px;
}

.portal-action-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.portal-action-group--links {
  padding: 3px 5px;
  border: 1px solid var(--rule);
}

.btn-reset-stats {
  border-color: var(--thread);
  color: var(--thread);
}

.portal-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.portal-audit-event {
  padding: 2px 7px;
  border: 1px solid var(--rule);
  color: var(--bone-2);
  font-size: 0.78rem;
}


/* Portal shapes in the new material */
body[data-lang] {
  display: flex;
  flex-direction: column;
}

body[data-lang] > main {
  flex: 1;
}

body[data-lang] .site-footer {
  padding-top: 0;
  border-top: 0;
}

body[data-lang] .footer-bottom {
  margin-top: 0;
  border-top: 0;
}

.portal-login-section {
  position: relative;
}

/* The shell is also a .container; its side padding must not eat into the card. */
.portal-login-shell {
  max-width: calc(480px + 2 * var(--gutter));
}

.portal-login-title {
  overflow-wrap: normal;
  hyphens: auto;
}

.portal-login-card {
  z-index: 4;
  padding: 34px 32px 26px;
  border: 1px solid var(--line);
  background: var(--glass), rgba(6, 8, 13, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 50px 100px -40px #000;
  --edge: 0.9;
}

.portal-login-card > * {
  position: relative;
  z-index: 1;
}

.portal-login-title,
.portal-title {
  font-weight: 620;
  font-variation-settings: normal;
  letter-spacing: -0.035em;
}

.portal-key-input-wrap {
  height: 54px;
  border-radius: 16px;
  background: rgba(3, 4, 8, 0.6);
}

.portal-key-input-wrap:focus-within {
  border-color: var(--ice);
  outline: none;
  box-shadow: 0 0 0 4px rgba(125, 185, 255, 0.2), 0 12px 40px -16px rgba(125, 185, 255, 0.5);
}

.portal-key-input,
.portal-key-input:hover,
.portal-key-input:focus {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.portal-key-btn {
  border-radius: 999px;
}

.portal-key-btn:hover {
  border-color: var(--text);
}

.portal-dash-header {
  border: 1px solid var(--line);
}

.portal-meta-card,
.portal-inquiry-detail,
.portal-vault-toolbar,
.portal-vault-empty,
.portal-workspace-notes,
.portal-secret-box,
.portal-direct-url-bar {
  border-radius: 16px;
}

.portal-secret-banner {
  border: 1px solid var(--ember);
  border-radius: var(--r-md);
}

.portal-alert,
.portal-inquiry-pre {
  border-radius: 14px;
}

.portal-badge,
.portal-type-badge,
.portal-vault-stats-pill,
.portal-file-icon,
.portal-role-tag,
.portal-audit-event,
.portal-vault-empty-icon {
  border-radius: 999px;
}

.portal-dashboard,
.portal-admin-console {
  position: relative;
  z-index: 4;
}

/* 17. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .portal-meta-grid,
  .portal-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 899px) {
  .primary-nav {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .menu-toggle {
    display: inline-flex;
  }

  body[data-lang] .site-header {
    height: auto;
    min-height: var(--header-h);
  }

  body[data-lang] .site-header .header-inner {
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    padding-block: 8px;
    border-radius: 30px;
  }

  /* Phone and tablet: the sculpture takes the upper part of the screen, the words the lower. */
  .hero-stage {
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 58vh;
    height: 58svh;
  }

  .hero::after {
    content: '';
    position: absolute;
    inset: 34% 0 0;
    z-index: 3;
    background: linear-gradient(180deg, rgba(5, 6, 10, 0), rgba(5, 6, 10, 0.82) 38%, var(--void) 78%);
    pointer-events: none;
  }

  .hero-title {
    max-width: none;
  }

  .hero-worlds {
    margin-top: clamp(16px, 3vh, 28px);
    padding-top: 0;
  }

  .worlds-grid,
  .founder-grid,
  .contact-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .worlds-stage {
    display: none;
  }

  /* The sculpture stands inside the open panel here, so the panel must not blur what is behind it. */
  .world {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--glass), rgba(8, 10, 16, 0.18);
  }

  .world-stage {
    display: block;
    height: 38vh;
    height: 38svh;
    min-height: 220px;
    margin-bottom: 4px;
  }

  .founder-visual {
    max-width: 440px;
  }
}

@media (max-width: 759px) {
  :root {
    --header-h: 68px;
    --gutter: 16px;
    --r-lg: 24px;
  }

  body {
    font-size: 1rem;
  }

  .site-header {
    padding-top: 10px;
  }

  .site-header .header-inner {
    height: 54px;
    gap: 8px;
    padding: 0 5px 0 16px;
  }

  .header-actions {
    gap: 4px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 25px;
    height: 25px;
  }

  .brand-text {
    font-size: 0.84rem;
    letter-spacing: 0.15em;
  }

  .lang-summary {
    padding-inline: 8px;
  }

  .lang-summary .chevron {
    display: none;
  }

  .btn-login {
    min-height: 44px;
    padding-inline: 13px;
    gap: 7px;
  }

  .btn-login-full {
    display: none;
  }

  .btn-login-short {
    display: inline;
  }

  .portal-auth-group .portal-logout-form {
    display: none;
  }

  .hero-title {
    font-size: clamp(2.05rem, 10.4vw, 3.2rem);
  }

  html[lang='de'] .hero-title,
  html[lang='ro'] .hero-title,
  html[lang='el'] .hero-title {
    font-size: clamp(1.85rem, 9.1vw, 3rem);
  }

  html[lang='ja'] .hero-title {
    font-size: clamp(1.8rem, 8.6vw, 2.8rem);
  }

  .hero-sub {
    font-size: 1rem;
    line-height: 1.5;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 420px;
    white-space: normal;
  }

  .hero-worlds {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .hero-world {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 38px;
    padding: 4px 0;
  }

  .hero-world-bar {
    margin-bottom: 0;
  }

  .form-row-2,
  .chat-inputs-top,
  .portal-form-row,
  .portal-meta-grid,
  .portal-kpi-grid,
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-input-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-foot .btn {
    width: 100%;
  }

  .world-toggle {
    width: 40px;
    height: 40px;
  }

  .legal-dl > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-login-card,
  .portal-dash-header,
  .portal-panel {
    padding: 24px 18px;
  }

  .portal-admin-actions {
    min-width: 220px;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Narrow phones: the lock stands on its own; its label lives in aria-label and in the menu. */
@media (max-width: 389px) {
  .site-header .header-actions .btn-login-short {
    display: none;
  }

  .site-header .header-actions [data-portal-login-btn] {
    width: 44px;
    padding-inline: 0;
    border-radius: 50%;
  }
}

/* Short screens: no room for the three world links under the action. They follow right below. */
@media (max-width: 899px) and (max-height: 640px) {
  .hero-worlds {
    display: none;
  }

  .hero-stage {
    height: 50vh;
    height: 50svh;
  }
}

@media (max-height: 520px) and (min-width: 560px) {
  .hero-stage {
    top: 0;
    right: -4%;
    bottom: 0;
    left: auto;
    width: 56%;
    height: auto;
  }

  .hero::after {
    display: none;
  }

  .hero-title {
    max-width: 52%;
    font-size: clamp(1.6rem, 7vh, 2.4rem);
  }

  .hero-sub {
    max-width: 50%;
    margin-top: 8px;
    font-size: 0.95rem;
  }

  .hero-actions {
    margin-top: 12px;
  }

  .hero-actions .btn {
    min-height: 46px;
    padding-block: 10px;
  }

  .hero-worlds {
    display: none;
  }
}

/* Narrow phones: the key field gets the full width, its two helpers sit underneath. */
@media (max-width: 480px) {
  .portal-key-input-wrap {
    flex-wrap: wrap;
    height: auto;
    padding: 4px 6px 6px 14px;
  }

  .portal-key-input,
  .portal-key-input:hover,
  .portal-key-input:focus {
    flex: 1 0 100%;
    height: 44px;
  }

  .portal-key-actions {
    width: 100%;
    margin-left: -8px;
  }

  .portal-key-btn {
    flex: 1;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .core-canvas,
  .core-glow,
  .menu-toggle {
    display: none !important;
  }

  html,
  body {
    background: #fff;
    color: #000;
  }
}
