:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1d2433;
  --sub: #4f5a6f;
  --line: #dfe3ee;
  --accent: #3b6df0;
  --accent-soft: #e8eefe;
  --background-wash: rgba(246, 247, 251, .82);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131c;
    --card: #1a2030;
    --text: #eef1f8;
    --sub: #b8c2d6;
    --line: #2b344a;
    --accent: #7ea2ff;
    --accent-soft: #232c45;
    --background-wash: rgba(15, 19, 28, .78);
  }

  body::before {
    background-image:
      linear-gradient(var(--background-wash), var(--background-wash)),
      url("portfolio-profile-background-dark.jpg");
  }

  .invert-dark {
    filter: invert(1);
  }

  .emoji-icon.bmac {
    background: #3a3210;
  }

  .emoji-icon.ofuse {
    background: #3a1c24;
  }
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.8;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--background-wash), var(--background-wash)),
    url("portfolio-profile-background-light.jpg");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

@media (prefers-color-scheme: dark) {
  body::before {
    background-image:
      linear-gradient(var(--background-wash), var(--background-wash)),
      url("portfolio-profile-background-dark.jpg");
  }
}

@media (max-width: 600px) {
  :root {
    --background-wash: rgba(246, 247, 251, .90);
  }

  body::before {
    /* 縦画面では背景画像を縦幅に合わせ、キーの模様が大きくなりすぎないようにする */
    background-size: auto 100vh;
  }
}

@media (max-width: 600px) and (prefers-color-scheme: dark) {
  :root {
    --background-wash: rgba(15, 19, 28, .86);
  }
}

.back-nav {
  margin-bottom: 20px;
}

.back-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.back-nav a:hover {
  text-decoration: underline;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 16px 56px;
}

.home-page main {
  padding-top: 40px;
}

header {
  text-align: center;
  margin-bottom: 24px;
}

.avatar {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0;
  border: 3px solid var(--card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.avatar-button {
  display: block;
  margin: 0 auto 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  line-height: 0;
  cursor: zoom-in;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.avatar-button:focus-visible,
.profile-image-dialog__close:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.profile-image-dialog {
  width: min(420px, calc(100vw - 40px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.profile-image-dialog::backdrop {
  background: rgba(8, 12, 22, .72);
}

.profile-image-dialog__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 3px solid var(--card);
  border-radius: 50%;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
}

.profile-image-dialog__close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .2);
  font: inherit;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
  letter-spacing: .04em;
}

.home-page h1 {
  font-size: 1.6rem;
}

.handle {
  color: var(--sub);
  font-size: .95rem;
  margin: 0;
}

.support-note {
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  margin: 8px 0 0;
  text-shadow: 0 0 6px var(--card), 0 0 2px var(--card);
}

.about {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 40px 20px 20px;
  margin-bottom: 28px;
}

.about h2 {
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.about p {
  margin: 0;
  font-size: 1rem;
}

.home-page .group {
  margin-bottom: 24px;
}

.subpage .group {
  margin-top: 28px;
}

.home-page .group h3,
.subpage .group h2 {
  font-size: .95rem;
  color: var(--text);
  letter-spacing: .05em;
  margin: 0 0 8px 4px;
}

.subpage .group h2 {
  margin-bottom: 10px;
}

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

.home-page .links {
  gap: 10px;
}

.subpage .links {
  gap: 12px;
}

.links a {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: all .2s ease;
}

.home-page .links a {
  padding: 12px 16px;
}

.subpage .links a {
  padding: 14px 16px;
}

.links a:hover,
.links a:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.link-icon {
  object-fit: cover;
  flex-shrink: 0;
}

.home-page .link-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  transition: filter .2s ease;
}

.home-page .discord-icon {
  padding: 6px;
  object-fit: contain;
  background: var(--accent-soft);
}

.subpage .link-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.emoji-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
}

.home-page .emoji-icon {
  font-size: 24px;
}

.subpage .emoji-icon {
  font-size: 26px;
}

.emoji-icon.bmac {
  background: #fff6cc;
}

.emoji-icon.ofuse {
  background: #ffeef2;
}

.link-content {
  flex: 1;
  min-width: 0;
}

.link-title {
  display: block;
  line-height: 1.4;
}

.home-page .link-title {
  font-size: 1rem;
}

.subpage .link-title {
  font-size: 1.05rem;
}

.links small {
  display: block;
  font-weight: 400;
  line-height: 1.5;
  color: var(--sub);
}

.home-page .links small {
  font-size: .88rem;
  margin-top: 2px;
}

.subpage .links small {
  font-size: .9rem;
  margin-top: 3px;
}

footer {
  text-align: center;
  color: var(--sub);
  font-size: .8rem;
}

.home-page footer {
  margin-top: 32px;
}

.subpage footer {
  margin-top: 40px;
}




/* Link-card descriptions for touch screens */
.links li {
  position: relative;
}

.home-page .links a,
.subpage .links a {
  padding-right: 36px;
}

.link-info-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--accent);
  font: inherit;
  font-size: .47rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.link-info-button::before {
  content: "";
  position: absolute;
  inset: -6px;
}

.link-info-button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .link-info-button {
    border-color: #a9bfff;
    background: #2b3854;
    color: #e5ecff;
    box-shadow: 0 0 0 1px rgba(126, 162, 255, .22);
  }
}

.link-info-button:focus-visible,
.link-info-dialog__close:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.link-info-dialog {
  width: min(420px, calc(100% - 32px));
  max-width: none;
  max-height: min(80vh, 480px);
  margin: auto;
  padding: 20px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
}

.link-info-dialog::backdrop {
  background: rgba(8, 12, 22, .58);
}

.link-info-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.link-info-dialog h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
}

.link-info-dialog p {
  margin: 12px 0 0;
  color: var(--sub);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.link-info-dialog__close {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.link-info-dialog__close:hover {
  color: var(--accent);
}

.qr-dialog .profile-image-dialog__image {
  border-radius: 24px;
  object-fit: contain;
  background: #fff;
}

.lang-switch {
  margin: 10px 0 0;
}

.lang-key {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 18px 4px 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}

.lang-key > span:last-child {
  clip-path: inset(0 0 0 max(0px, calc(var(--slide, 0px) - 10px)));
  background: linear-gradient(90deg, color-mix(in srgb, var(--text) 60%, transparent) 35%, var(--text) 50%, color-mix(in srgb, var(--text) 60%, transparent) 65%) 100% 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 2.6s linear infinite;
}

.lang-key.is-sliding > span:last-child {
  animation-play-state: paused;
}

@keyframes shine {
  to {
    background-position: 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lang-key > span:last-child {
    animation: none;
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}

.lang-key__num {
  position: relative;
  z-index: 1;
  transform: translateX(var(--slide, 0));
  transition: transform .25s ease;
  touch-action: none;
  -webkit-user-drag: none;
  cursor: grab;
  user-select: none;
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 34px;
  border: 1px solid rgba(0, 0, 0, .35);
  border-radius: 7px;
  background: linear-gradient(#fdfdfd, #d9d9de 50%, #b9b9c0);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0, 0, 0, .3);
  color: #333;
  font-size: 1.1rem;
  font-weight: 700;
}

.lang-key.is-sliding .lang-key__num {
  transition: none;
  cursor: grabbing;
}

.is-arriving {
  animation: arrive .6s cubic-bezier(.2, .7, .2, 1);
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: scale(.94);
    filter: blur(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-arriving {
    animation: none;
  }
}

.links a .link-icon {
  position: relative;
  z-index: 1;
  touch-action: pan-y;
  -webkit-user-drag: none;
  user-select: none;
}

.footer-age {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: default;
}

.konami-pad {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  gap: 12px;
}

.konami-pad[hidden] {
  display: none;
}

.konami-pad button {
  width: 52px;
  height: 52px;
  border: 2px solid #5a0f1a;
  border-radius: 50%;
  background: #d62b3d;
  box-shadow: 0 3px 0 #5a0f1a, 0 6px 14px rgba(0, 0, 0, .3);
  color: #fff;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.konami-pad button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #5a0f1a;
}

.konami-key {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.link-info-dialog.famicom {
  border: 5px solid #c5192d;
  border-radius: 12px;
  background: #dcc392;
  color: #1a1a1a;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .4);
}

.famicom .link-info-dialog__header {
  justify-content: flex-start;
}

.famicom h2 {
  padding: 3px 12px;
  background: #1a1a1a;
  color: #dcc392;
}

.famicom .link-info-dialog__close {
  margin-left: auto;
  color: #1a1a1a;
}

.famicom.link-info-dialog p {
  margin-top: 18px;
  color: #1a1a1a;
  font-weight: 600;
}

.famicom.link-info-dialog::after {
  content: "";
  display: block;
  height: 5px;
  margin-top: 18px;
  border-top: 2px solid #1a1a1a;
  border-bottom: 2px solid #1a1a1a;
}

.konami-pad.famicom {
  padding: 8px;
  border-radius: 12px;
  background: #c5192d;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .35);
}

.konami-pad.famicom .konami-key:first-child {
  margin-left: 0;
}

.konami-pad.famicom {
  gap: 0;
}

.konami-pad.famicom .konami-key {
  padding: 8px 12px 10px;
  background: #dcc392;
}

.konami-pad.famicom .konami-key:first-child {
  border-radius: 8px 0 0 8px;
}

.konami-pad.famicom .konami-key:last-child {
  border-radius: 0 8px 8px 0;
}

.konami-key__label {
  padding: 1px 12px;
  border-radius: 999px;
  background: #1a1a1a;
  color: #dcc392;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.4;
}

.konami-pad.famicom button {
  border: 2px solid #000;
  background: radial-gradient(circle at 35% 30%, #5a5a5a, #1a1a1a 60%);
  box-shadow: 0 3px 0 #000;
}

.link-info-dialog.nes {
  border: 6px solid #c9c5bc;
  border-radius: 8px;
  background: #1c1c1c;
  color: #e8e4dc;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
}

.nes .link-info-dialog__header {
  justify-content: flex-start;
}

.nes h2 {
  color: #d9302a;
  letter-spacing: .06em;
}

.nes .link-info-dialog__close {
  margin-left: auto;
  color: #e8e4dc;
}

.nes.link-info-dialog p {
  margin-top: 18px;
  color: #e8e4dc;
}

.nes.link-info-dialog::after {
  content: "";
  display: block;
  height: 8px;
  margin-top: 18px;
  background: #4a4a4a;
}

.konami-pad.nes {
  gap: 10px;
  padding: 10px 14px;
  border: 3px solid #c9c5bc;
  border-radius: 6px;
  background: #1c1c1c;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .35);
}

.konami-pad.nes .konami-key {
  justify-items: center;
}

.konami-pad.nes .konami-key__label {
  order: 2;
  padding: 0;
  background: none;
  color: #d9302a;
  font-size: .8rem;
}

.konami-pad.nes button {
  width: 52px;
  height: 52px;
  border: 7px solid #c9c5bc;
  border-radius: 4px;
  background: radial-gradient(circle, #e0352d 0 62%, #c9c5bc 64%);
  box-shadow: none;
}

.konami-pad.nes button:active {
  transform: translateY(1px);
}

.konami-pad.famicom button {
  border: 2px solid #050505;
  background: radial-gradient(circle at 62% 68%, #4b4b4b, #141414 72%);
  box-shadow:
    inset 3px 4px 6px rgba(0, 0, 0, .9),
    inset -1px -2px 2px rgba(255, 255, 255, .22),
    0 1px 0 rgba(255, 255, 255, .45);
}

.konami-pad.famicom button:active {
  box-shadow:
    inset 4px 5px 8px rgba(0, 0, 0, .95),
    inset -1px -1px 2px rgba(255, 255, 255, .15),
    0 1px 0 rgba(255, 255, 255, .45);
  transform: none;
}

.konami-pad.nes button {
  position: relative;
  border: 0;
  background: #c9c5bc;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, .35);
}

.konami-pad.nes button::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 62% 68%, #f2584d, #c4271f 55%, #9a1912);
  box-shadow:
    inset 2px 3px 4px rgba(0, 0, 0, .55),
    inset -1px -2px 2px rgba(255, 255, 255, .25);
}

.konami-pad.nes button:active::before {
  box-shadow:
    inset 3px 4px 6px rgba(0, 0, 0, .7),
    inset -1px -1px 2px rgba(255, 255, 255, .15);
}

.konami-pad.nes button:active {
  transform: none;
}

.konami-pad.famicom button {
  position: relative;
  border: 0;
  background: linear-gradient(145deg, #6a6a6a, #0c0c0c);
  box-shadow: 0 3px 0 #000, 0 5px 6px rgba(0, 0, 0, .45);
}

.konami-pad.famicom button::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: linear-gradient(145deg, #060606, #3a3a3a);
  box-shadow: inset 2px 3px 4px rgba(0, 0, 0, .9);
}

.konami-pad.famicom button:active {
  box-shadow: 0 1px 0 #000;
  transform: translateY(2px);
}

.konami-pad.nes button::before {
  inset: 5px;
  background: linear-gradient(145deg, #ff857b, #8b130d);
  box-shadow: 0 2px 0 #4f0a06, 0 3px 4px rgba(0, 0, 0, .5);
}

.konami-pad.nes button::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: linear-gradient(145deg, #a51d17, #ec4a40);
  box-shadow: inset 2px 3px 4px rgba(0, 0, 0, .55);
}

.konami-pad.nes button:active::before {
  box-shadow: 0 0 0 #4f0a06;
  transform: translateY(2px);
}

.konami-pad.nes button:active::after {
  transform: translateY(2px);
}

/* Work / portfolio pages */
.work-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 18px;
  line-height: 1.75;
}

.work-card p {
  margin: 0 0 8px;
}

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

.work-card ul,
.work-card ol {
  margin: 0;
  padding-left: 1.3em;
}

.work-card li + li {
  margin-top: 4px;
}

.work-note {
  margin: 6px 6px 0;
  font-size: .88rem;
  line-height: 1.65;
  color: var(--sub);
}
