:root {
  --bg-main: #adebb3;
  --bg-secondary: #afeeee;
  --text-color: #2f2f2f;
  --border-color: rgba(76, 76, 76, 0.46);
  --card-border-color: rgba(76, 76, 76, 0.28);
  --font-heading: Georgia, Cambria, "Times New Roman", serif;
  --font-body: Georgia, Cambria, "Times New Roman", serif;
  --font-ui: Arial, Helvetica, sans-serif;
  --card-bg: rgba(255, 255, 255, 0.22);
  --surface-bg: rgba(244, 242, 236, 0.28);
  --button-bg: rgba(76, 76, 76, 0.08);
  --button-bg-active: rgba(76, 76, 76, 0.24);
  --button-bg-hover: rgba(76, 76, 76, 0.16);
  --button-text: #202020;
  --button-text-active: #111111;
  --glow-shadow: none;
  --card-corners: 8px;
  --content-clip: none;
  --portrait-filter: contrast(0.96) saturate(0.88);
  --image-filter: saturate(0.9) contrast(0.98);
  --image-hover-filter: saturate(1.02) contrast(1.04);
  --moodboard-filter: grayscale(0.2) contrast(0.95);
  --ink: #4c4c4c;
  --text: var(--text-color);
  --muted: #616161;
  --list: #d3d3d3;
  --left-bg: var(--bg-main);
  --right-bg: var(--bg-secondary);
  --paper: #f4f2ec;
  --edge: rgba(57, 57, 57, 0.42);
  --focus: #1a5f5e;
  --body-background:
    linear-gradient(rgba(244, 242, 236, 0.78), rgba(244, 242, 236, 0.78)),
    url("assets/paper-grain.png");
}

body.cyber-mode {
  --bg-main: #000000;
  --bg-secondary: #2d2d2d;
  --text-color: #2cff05;
  --border-color: #bf00ff;
  --card-border-color: #2cff05;
  --font-heading: "Courier New", Courier, monospace;
  --font-body: "Courier New", Courier, monospace;
  --font-ui: "Courier New", Courier, monospace;
  --card-bg: #2d2d2d;
  --surface-bg: rgba(0, 0, 0, 0.76);
  --button-bg: rgba(44, 255, 5, 0.08);
  --button-bg-active: rgba(44, 255, 5, 0.2);
  --button-bg-hover: rgba(191, 0, 255, 0.2);
  --button-text: #2cff05;
  --button-text-active: #ffffff;
  --glow-shadow: 0 0 10px #bf00ff, inset 0 0 10px #bf00ff;
  --card-corners: 0;
  --content-clip: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 0 100%);
  --portrait-filter: contrast(140%) hue-rotate(270deg) saturate(1.25);
  --image-filter: contrast(125%) saturate(1.25) hue-rotate(250deg);
  --image-hover-filter: contrast(140%) saturate(1.45) hue-rotate(250deg);
  --moodboard-filter: contrast(130%) saturate(1.4) hue-rotate(220deg);
  --ink: #2cff05;
  --text: var(--text-color);
  --left-bg: var(--bg-main);
  --right-bg: var(--bg-secondary);
  --muted: #8aff78;
  --paper: #050505;
  --edge: rgba(44, 255, 5, 0.55);
  --focus: #bf00ff;
  --body-background:
    linear-gradient(90deg, rgba(191, 0, 255, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(44, 255, 5, 0.08) 1px, transparent 1px),
    #000000;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  background: var(--body-background);
  background-size: auto, auto, auto;
  color: var(--text);
  font-family: var(--font-body);
  transition: background-color 180ms ease, color 180ms ease;
}

body.cyber-mode {
  background-size: 34px 34px, 34px 34px, auto;
  text-shadow: 0 0 4px rgba(44, 255, 5, 0.65);
}

body.cyber-mode::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 19;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 58%, rgba(0, 0, 0, 0.28) 100%);
  opacity: 0.45;
}

a {
  color: inherit;
}

.poster {
  width: min(86vw, 86dvh);
  max-width: 840px;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: 49% 51%;
  overflow: hidden;
  position: relative;
  background: var(--paper);
  border: 1px solid var(--edge);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.18);
  container-type: inline-size;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.poster::before,
.poster::after,
.left-panel::before,
.right-panel::before {
  content: "";
  position: absolute;
  pointer-events: none;
}

.poster::before {
  inset: 0;
  background-image: url("assets/paper-grain.png");
  background-size: 96px 96px;
  opacity: 0.2;
  mix-blend-mode: multiply;
  z-index: 7;
}

.poster::after {
  inset: 2.8%;
  border: 2px solid var(--edge);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.16),
    inset 0 0 18px rgba(0, 0, 0, 0.18);
  mask-image:
    linear-gradient(90deg, transparent 0 1.5%, #000 4% 96%, transparent 98.5%),
    linear-gradient(#000, #000);
  z-index: 8;
}

body.cyber-mode .poster {
  border-width: 2px;
  box-shadow:
    var(--glow-shadow),
    0 0 42px rgba(44, 255, 5, 0.25);
}

body.cyber-mode .poster::before {
  opacity: 0.08;
  mix-blend-mode: screen;
}

body.cyber-mode .poster::after {
  border-color: #2cff05;
  box-shadow:
    0 0 16px rgba(44, 255, 5, 0.75),
    inset 0 0 12px rgba(191, 0, 255, 0.72);
}

.left-panel,
.right-panel {
  position: relative;
  min-width: 0;
  padding: 6.2% 6% 5.4%;
  overflow: hidden;
}

.left-panel {
  background: var(--left-bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background-color 180ms ease;
}

.right-panel {
  background: var(--right-bg);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 2.2%;
  transition: background-color 180ms ease;
}

.left-panel::before,
.right-panel::before {
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.13), transparent 28%, rgba(0,0,0,0.04)),
    url("assets/paper-grain.png");
  opacity: 0.34;
  mix-blend-mode: multiply;
}

body.cyber-mode .left-panel::before,
body.cyber-mode .right-panel::before {
  background:
    linear-gradient(90deg, rgba(44, 255, 5, 0.08), transparent 36%, rgba(191, 0, 255, 0.12)),
    url("assets/paper-grain.png");
  opacity: 0.18;
  mix-blend-mode: screen;
}

.photo-frame {
  position: relative;
  height: 65%;
  border: 2px solid var(--edge);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.12), rgba(0,0,0,0.03)),
    var(--left-bg);
  overflow: hidden;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.12);
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("assets/paper-grain.png");
  background-size: 96px 96px;
  opacity: 0.2;
  mix-blend-mode: multiply;
  pointer-events: none;
}

#portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  display: block;
  filter: var(--portrait-filter);
  transition: opacity 170ms ease, transform 220ms ease, filter 180ms ease;
}

body.cyber-mode .photo-frame {
  border-color: #2cff05;
  box-shadow: var(--glow-shadow);
}

#portrait.is-switching {
  opacity: 0;
  transform: translateY(1.4%);
}

#portrait[data-active-tab="games"] {
  object-fit: cover;
  object-position: center bottom;
}

.name-block {
  position: relative;
  z-index: 1;
  padding-top: 4.5%;
}

.meta,
.link-pill {
  font-family: var(--font-ui);
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(33px, 7.25cqw, 61px);
}

h1[data-lang="zh"] {
  font-size: clamp(38px, 8.3cqw, 70px);
  line-height: 0.98;
}

h1[data-lang="ja"] {
  font-size: clamp(30px, 6.6cqw, 55px);
  line-height: 0.94;
}

.kana-name {
  display: block;
  margin-top: 0.1em;
  font-size: 0.34em;
  line-height: 1.05;
}

h2 {
  font-size: clamp(32px, 6.8cqw, 57px);
}

.top-tools {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: flex-start;
  justify-content: space-between;
}

.language-nav {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.cyber-toggle,
.language-button {
  min-height: 20px;
  border: 1px solid var(--border-color);
  background: var(--button-bg);
  color: var(--button-text);
  cursor: pointer;
  font: 800 clamp(9px, 1.35cqw, 11px) / 1 var(--font-ui);
  padding: 4px 7px;
  text-transform: uppercase;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    text-shadow 180ms ease;
}

.cyber-toggle {
  flex: 1 1 auto;
  max-width: max-content;
  text-align: left;
  white-space: nowrap;
}

.language-button[aria-pressed="true"] {
  background: var(--button-bg-active);
  color: var(--button-text-active);
}

.cyber-toggle:hover,
.language-button:hover {
  background: var(--button-bg-hover);
}

body.cyber-mode .cyber-toggle {
  border-color: #2cff05;
  box-shadow:
    0 0 12px rgba(44, 255, 5, 0.82),
    inset 0 0 8px rgba(44, 255, 5, 0.3);
  color: #2cff05;
  text-shadow: 0 0 8px #2cff05;
  animation: cyber-pulse 1.2s infinite alternate;
}

.tab-nav {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 1px;
  padding: 1.3% 0 1.7%;
  border-block: 1px solid var(--card-border-color);
}

.tab-button {
  width: 100%;
  min-height: clamp(20px, 3.35cqw, 28px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 700 clamp(13px, 2.25cqw, 19px) / 1.04 var(--font-heading);
  text-align: left;
  cursor: pointer;
}

.tab-button span {
  display: inline-block;
  width: 1.55em;
  color: var(--ink);
}

.tab-button[aria-selected="true"] {
  color: var(--button-text-active);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.tab-button:not([aria-selected="true"]) {
  color: var(--muted);
}

.tab-button:hover {
  color: var(--button-text-active);
}

.tab-button:focus-visible,
.cyber-toggle:focus-visible,
.language-button:focus-visible,
.link-pill:focus-visible,
.article-link:focus-visible,
.image-button:focus-visible,
.shot-next:focus-visible,
.lightbox-close:focus-visible,
.lightbox-backdrop:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.content-shell {
  min-height: 0;
  position: relative;
  z-index: 1;
  border: 1px solid var(--card-border-color);
  border-radius: var(--card-corners);
  background: var(--surface-bg);
  clip-path: var(--content-clip);
  overflow: hidden;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    border-radius 180ms ease,
    box-shadow 180ms ease;
}

.tab-content {
  height: 100%;
  overflow: auto;
  padding: 3.2%;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.tab-content::-webkit-scrollbar {
  width: 7px;
}

.tab-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
}

.section-title {
  margin: 0 0 2.3%;
  color: var(--ink);
  font-size: clamp(20px, 3.35cqw, 28px);
  line-height: 0.94;
  text-transform: uppercase;
}

.dek {
  margin: 0 0 2.8%;
  font-size: clamp(12px, 1.76cqw, 14.8px);
  line-height: 1.25;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.2cqw, 12px);
}

.info-card,
.project-card,
.writing-card,
.video-card {
  border: 1px solid var(--card-border-color);
  border-radius: var(--card-corners);
  background: var(--card-bg);
  clip-path: var(--content-clip);
  padding: 2.8%;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    border-radius 180ms ease,
    box-shadow 180ms ease;
}

.info-card h4,
.project-card h4,
.writing-card h4,
.video-card h4 {
  margin: 0 0 1.7%;
  color: var(--ink);
  font-size: clamp(13px, 1.85cqw, 15.5px);
  line-height: 1.06;
}

.info-card p,
.project-card p,
.writing-card p,
.video-card p {
  margin: 0;
  font-size: clamp(11px, 1.62cqw, 13.4px);
  line-height: 1.24;
}

.stack {
  display: grid;
  gap: 2.5%;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2.6%;
}

.link-pill,
.article-link {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border: 1px solid var(--border-color);
  background: var(--button-bg);
  color: var(--button-text);
  font-family: var(--font-ui);
  font-size: clamp(9px, 1.35cqw, 11px);
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

.link-pill:hover,
.article-link:hover {
  background: var(--button-bg-hover);
  color: var(--button-text-active);
}

.link-pill {
  padding: 4px 6px;
}

.article-list {
  display: grid;
  gap: 4px;
  margin: 2.4% 0 0;
}

.article-link {
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 5px 6px;
}

.article-link small {
  color: var(--muted);
  font-size: 0.82em;
  white-space: nowrap;
}

.moodboard,
.moodboard-zoom img {
  width: 100%;
  aspect-ratio: 16 / 8.5;
  object-fit: cover;
  display: block;
  border: 1px solid var(--card-border-color);
  filter: var(--moodboard-filter);
}

.writing-layout {
  display: grid;
  gap: 2.5%;
}

.moodboard-card {
  padding: 0;
  overflow: hidden;
}

.image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.image-button:hover img {
  filter: var(--image-hover-filter);
}

.project-card {
  display: grid;
  grid-template-columns: 34% 1fr;
  gap: 2.5%;
}

.project-card + .project-card,
.video-card + .video-card {
  margin-top: 2.4%;
}

.thumb-strip {
  display: grid;
  gap: 4px;
}

.thumb-strip img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border: 1px solid var(--card-border-color);
  filter: var(--image-filter);
}

.shot-next {
  width: 100%;
  min-height: 20px;
  border: 1px solid var(--border-color);
  border-radius: 0;
  background: var(--button-bg);
  color: var(--button-text);
  cursor: pointer;
  box-shadow: none;
  font: 800 clamp(8.5px, 1.22cqw, 10px) / 1 var(--font-ui);
  text-transform: uppercase;
}

.shot-next:hover {
  background: var(--button-bg-hover);
  color: var(--button-text-active);
}

.meta {
  margin-bottom: 1.6%;
  color: var(--muted);
  font-size: clamp(8.8px, 1.25cqw, 10.5px);
  font-weight: 800;
  text-transform: uppercase;
}

.quote {
  margin: 3% 0 0;
  padding-left: 2.5%;
  border-left: 3px solid var(--border-color);
  font-size: clamp(12px, 1.75cqw, 14.5px);
  line-height: 1.18;
}

.video-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 3%;
  align-items: center;
}

.video-card .meta,
.video-card h4,
.video-card p {
  grid-column: 1;
}

.video-card .link-row {
  grid-column: 2;
  grid-row: 1 / span 3;
  justify-content: flex-end;
  margin-top: 0;
}

body.cyber-mode .content-shell,
body.cyber-mode .info-card,
body.cyber-mode .project-card,
body.cyber-mode .writing-card,
body.cyber-mode .video-card {
  border-width: 2px;
  box-shadow: var(--glow-shadow);
}

body.cyber-mode .tab-nav {
  box-shadow:
    0 -1px 0 rgba(191, 0, 255, 0.7),
    0 1px 0 rgba(44, 255, 5, 0.7);
}

#cyber-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(4px);
}

#cyber-transition-overlay .scan-beam {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: #2cff05;
  box-shadow:
    0 0 15px 3px #2cff05,
    0 0 30px 8px #bf00ff;
  opacity: 0;
  transform: translateY(-10px);
}

#cyber-transition-overlay.active {
  animation: cyber-backdrop 450ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#cyber-transition-overlay.active .scan-beam {
  animation: scanline-sweep 450ms cubic-bezier(0.65, 0.05, 0.36, 1) forwards;
}

body.transitioning {
  animation: rgb-split 450ms steps(4) forwards;
}

@keyframes cyber-backdrop {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes scanline-sweep {
  0% {
    opacity: 1;
    transform: translateY(0vh);
  }
  100% {
    opacity: 0.2;
    transform: translateY(100vh);
  }
}

@keyframes rgb-split {
  0%,
  100% {
    filter: none;
  }
  25% {
    filter:
      drop-shadow(-4px 0 0 rgba(191, 0, 255, 0.8))
      drop-shadow(4px 0 0 rgba(44, 255, 5, 0.8));
  }
  50% {
    filter:
      drop-shadow(4px 0 0 rgba(191, 0, 255, 0.8))
      drop-shadow(-4px 0 0 rgba(44, 255, 5, 0.8));
  }
  75% {
    filter: none;
  }
}

@keyframes cyber-pulse {
  from {
    box-shadow:
      0 0 7px rgba(44, 255, 5, 0.65),
      inset 0 0 6px rgba(44, 255, 5, 0.25);
  }
  to {
    box-shadow:
      0 0 16px rgba(44, 255, 5, 0.95),
      inset 0 0 11px rgba(44, 255, 5, 0.42);
  }
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 4vmin;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(20, 24, 24, 0.74);
  cursor: zoom-out;
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 1080px);
  max-height: 88dvh;
  margin: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-color);
  background: var(--paper);
  box-shadow: 0 20px 90px rgba(0, 0, 0, 0.42);
}

.lightbox-panel img {
  max-width: 100%;
  max-height: 74dvh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--card-border-color);
}

.lightbox-close {
  justify-self: end;
  border: 1px solid var(--border-color);
  background: var(--button-bg);
  color: var(--text);
  cursor: pointer;
  font: 800 11px / 1 var(--font-ui);
  padding: 6px 8px;
  text-transform: uppercase;
}

#lightbox-caption {
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
}

@media (max-width: 620px) {
  .poster {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    aspect-ratio: auto;
    border: 0;
  }

  .left-panel,
  .right-panel {
    padding: 5.2% 4.9%;
  }

  #portrait {
    object-fit: cover;
    object-position: center bottom;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .project-card {
    grid-template-columns: 1fr;
  }

  .thumb-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 620px) and (orientation: portrait) {
  .poster {
    grid-template-columns: 1fr;
    grid-template-rows: 50% 50%;
  }

  .left-panel {
    padding: 4.2% 5.2% 3.2%;
  }

  .right-panel {
    padding: 3.4% 5.2% 4.2%;
  }

  .photo-frame {
    height: 68%;
  }

  #portrait,
  #portrait[data-active-tab="games"] {
    object-fit: contain;
    object-position: center bottom;
  }

  h1 {
    font-size: clamp(32px, 13.2vw, 50px);
    line-height: 0.82;
  }

  .tab-button {
    min-height: 21px;
    font-size: clamp(14px, 4.25vw, 18px);
  }

  .section-title {
    font-size: clamp(22px, 6.7vw, 28px);
  }
}

@media (max-width: 920px) and (orientation: landscape) {
  .poster {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    aspect-ratio: auto;
    grid-template-columns: 49% 51%;
    border: 0;
  }
}
