:root {
  --text-color: #37393e;
  --text-service: #dbdbdb;
  --text-light: #666;
  --border-color: #e5e5e5;
  --accent-color: #c1c1c1;
  --top-decoration-height: 370px;
  --top-decoration-size: 1280px auto;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-8: 64px;
  --space-10: 80px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  touch-action: manipulation;
}

body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  padding: var(--space-5) 20px calc(var(--space-5) + env(safe-area-inset-bottom));
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  background: #ffffff;
}

body.viewer-open {
  overflow: hidden;
}

body::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 0;
  height: var(--top-decoration-height);
  background:
    linear-gradient(rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.88)),
    url("/assets/footer.f1566a0f56.webp") center top / var(--top-decoration-size) no-repeat;
  content: "";
  pointer-events: none;
  transform: scaleY(-1);
}

.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}

.profile {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-8);
  padding: var(--space-6) 0;
}

.profile img {
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 24px;
  object-fit: cover;
}

.profile-image-block {
  display: grid;
  justify-items: center;
}

.profile-credit {
  display: block;
  justify-self: stretch;
  margin-top: 9px;
  color: var(--text-color);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  text-align: right;
  text-decoration: none;
}

.profile-credit span {
  color: #b2b2b2;
  font-weight: 500;
}

.profile-credit:hover {
  color: var(--accent-color);
}

.profile .info h2 {
  margin-bottom: var(--space-2);
  color: var(--text-color);
  font-size: 1.75em;
  font-weight: 600;
  cursor: pointer;
}

.profile .info p {
  color: var(--text-light);
  font-size: 1.1em;
  font-weight: 400;
  line-height: 1.6;
}

.profile .info .subdued {
  margin-top: var(--space-2);
  color: #999;
  font-size: 0.95em;
  font-weight: 400;
  line-height: 1.8;
}

.section {
  margin-bottom: var(--space-6);
}

.section-title {
  max-width: 600px;
  margin: 0 auto 10px;
  color: #999;
  font-size: 0.92em;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.link-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.link-item {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
}

.link-button {
  position: relative;
  display: flex;
  flex: 1;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  overflow: hidden;
  padding: 14px 20px;
  border: 2px solid var(--text-color);
  border-radius: 12px;
  color: inherit;
  text-align: left;
  text-decoration: none;
  background: #ffffff;
  transition: all 0.2s ease;
}

.link-button:hover {
  border: 2px solid var(--accent-color);
  box-shadow: 4px 4px 0 var(--text-color);
  transform: translate(-2px, -2px);
}

.link-button:focus-visible,
.label-copy-button:focus-visible,
.latest-image-viewer-close:focus-visible,
.latest-image-viewer-image-button:focus-visible,
.latest-image-viewer-link:focus-visible,
.btn-a:focus-visible,
.dpad button:focus-visible,
.copy-button:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

.link-content {
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  transition: color 0.2s ease;
}

.link-service {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 0;
  display: inline-block;
  padding: 0;
  color: var(--text-service);
  font-size: 1.2em;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.link-service::after {
  position: absolute;
  inset: 0;
  color: var(--service-active-color, currentColor);
  content: attr(data-transition-label);
  clip-path: inset(0 100% 0 0);
  opacity: 0;
  pointer-events: none;
  transition:
    clip-path 0.24s ease,
    opacity 0.12s ease;
}

.link-service.transition-coloring::after {
  clip-path: inset(0 0 0 0);
  opacity: 1;
}

.link-user {
  display: none;
}

.link-item:hover .link-service,
.link-item:active .link-service,
.link-item.virtual-hover .link-service {
  color: var(--text-color);
  font-size: 1.5em;
}

.link-item:hover .link-button,
.link-item.virtual-hover .link-button {
  border: 2px solid var(--accent-color);
}

body.cursor-mode-active .link-item:hover .link-service {
  color: var(--text-service);
  font-size: 1.2em;
}

body.cursor-mode-active .link-item:hover .link-button {
  border: 2px solid var(--text-color);
}

body.cursor-mode-active .link-item.virtual-hover .link-service {
  color: var(--accent-color);
  font-size: 1.5em;
}

body.cursor-mode-active .link-item.virtual-hover .link-button {
  border: 2px solid var(--accent-color);
}

.labelled-link-section .link-group {
  gap: calc(var(--space-2) + 14px);
}

.labelled-link-section .link-item {
  margin-top: 14px;
}

.labelled-link-section .link-button {
  min-height: 62px;
  overflow: visible;
  padding: 18px 20px 14px;
}

.labelled-link-section .link-button {
  isolation: isolate;
}

.labelled-link-section .link-button::after {
  position: absolute;
  inset: -2px;
  z-index: 2;
  border: inherit;
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.labelled-link-section .link-label {
  position: absolute;
  top: -18px;
  left: 18px;
  z-index: 5;
  display: inline-flex;
  gap: 3px;
  align-items: center;
  padding: 0 6px 0 8px;
  background: #fff;
  transition: transform 0.2s ease;
}

.labelled-link-section .link-label .link-service {
  position: relative;
  padding: 0;
  color: #9f9f9f;
  font-size: var(--service-label-size, 1.35em);
  font-weight: 800;
  background: transparent;
}

.link-item[data-service="mail"] {
  --link-main-size: 1.08em;
  --service-label-size: 1.22em;
}

.link-item[data-service="buymeacoffee"] .link-button {
  flex-direction: column;
  gap: 0;
  align-items: flex-start;
  justify-content: center;
}

.link-item[data-service="concrnt"] {
  --link-user-hover-size: 0.88em;
  --link-user-size: 0.72em;
}

.link-item[data-service="activitypub"] {
  --link-user-hover-size: 1.2em;
  --link-user-size: 1em;
}

.latest-thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(var(--latest-thumbnail-count, 5), minmax(0, 1fr));
  gap: 8px;
  max-width: 600px;
  margin: -4px auto 0;
}

.latest-thumbnail {
  display: block;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid #e1e1e1;
  border-radius: 8px;
  background: #f8f8f8;
  cursor: zoom-in;
  -webkit-user-drag: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.latest-thumbnail:hover {
  border-color: var(--accent-color);
  box-shadow: 3px 3px 0 var(--text-color);
  transform: translate(-1px, -1px);
}

.latest-thumbnail:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

.latest-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

.latest-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.latest-image-viewer[hidden] {
  display: none;
}

.latest-image-viewer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.latest-image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
}

.latest-image-viewer-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  justify-items: center;
  width: min(960px, 100%);
  height: 100%;
  max-height: 100%;
  pointer-events: none;
}

.latest-image-viewer-image-button {
  display: block;
  align-self: center;
  justify-self: center;
  max-width: min(92vw, 960px);
  max-height: min(100%, 760px);
  overflow: hidden;
  padding: 0;
  border: 2px solid rgba(55, 57, 62, 0.16);
  border-radius: 10px;
  cursor: zoom-out;
  background: #fff;
  box-shadow: 0 18px 48px rgba(55, 57, 62, 0.18);
  touch-action: none;
  -webkit-user-drag: none;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.82);
  transition:
    opacity 0.18s ease,
    transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.latest-image-viewer.is-open .latest-image-viewer-image-button {
  opacity: 1;
  transform: scale(1);
}

.latest-image-viewer.is-closing .latest-image-viewer-image-button {
  opacity: 0;
  transform: scale(0.82);
}

.latest-image-viewer-image-button.is-image-changing {
  transform: scale(0.96);
}

.latest-image-viewer-image {
  display: block;
  width: auto;
  max-width: min(92vw, 960px);
  height: auto;
  max-height: min(100%, 760px);
  object-fit: contain;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

.latest-image-viewer-actions {
  display: flex;
  align-self: end;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: clamp(0px, 2vh, 16px);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.18s ease 0.06s,
    transform 0.2s ease 0.06s;
}

.latest-image-viewer.is-open .latest-image-viewer-actions {
  opacity: 1;
  transform: translateY(0);
}

.latest-image-viewer-close,
.latest-image-viewer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 6px 14px;
  border: 2px solid rgba(55, 57, 62, 0.18);
  border-radius: 999px;
  color: var(--text-color);
  font-size: 0.9em;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(55, 57, 62, 0.1);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.latest-image-viewer-link::after {
  margin-left: 0.4em;
  content: "↗";
}

.latest-image-viewer-close:hover,
.latest-image-viewer-link:hover {
  border-color: var(--text-color);
}

.labelled-link-section .link-item:hover .link-service,
.labelled-link-section .link-item:active .link-service,
.labelled-link-section .link-item.virtual-hover .link-service,
body.cursor-mode-active .labelled-link-section .link-item:hover .link-service {
  color: #8c8c8c;
  font-size: var(--service-label-size, 1.35em);
}

.sns-section .link-user {
  position: absolute;
  right: 4px;
  bottom: 3px;
  z-index: 0;
  display: inline;
  max-width: calc(100% - 8px);
  overflow: hidden;
  color: var(--text-service);
  font-size: var(--link-user-size, 1.2em);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: all 0.2s ease;
  pointer-events: none;
}

.sns-section .link-item:hover .link-user,
.sns-section .link-item:active .link-user,
.sns-section .link-item.virtual-hover .link-user {
  color: var(--text-color);
  font-size: var(--link-user-hover-size, 1.5em);
}

.label-copy-button {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 999px;
  color: #b0b0b0;
  cursor: pointer;
  background: transparent;
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    transform 0.2s ease;
}

.label-copy-button:hover,
.label-copy-button:focus-visible,
.label-copy-button.copied {
  color: var(--text-color);
  background: #f3f3f3;
}

.label-copy-button:active {
  transform: scale(0.92);
}

.label-copy-button svg {
  width: 14px;
  height: 14px;
}

.labelled-link-section .link-item:hover .link-label,
.labelled-link-section .link-item.virtual-hover .link-label {
  transform: translate(-2px, -2px);
}

body.cursor-mode-active .labelled-link-section .link-item:hover .link-label {
  transform: none;
}

body.cursor-mode-active .labelled-link-section .link-item.virtual-hover .link-label {
  transform: translate(-2px, -2px);
}

body.cursor-mode-active .sns-section .link-item:hover .link-user {
  color: var(--text-service);
  font-size: var(--link-user-size, 1.2em);
}

body.cursor-mode-active .sns-section .link-item.virtual-hover .link-user {
  color: var(--accent-color);
  font-size: var(--link-user-hover-size, 1.5em);
}

.account-name {
  margin-right: 0.2em;
  font-size: 0.7em;
}

.link-main {
  color: var(--text-color);
  font-size: var(--link-main-size, 1em);
  font-weight: 600;
  line-height: 1.4;
}

.copy-button {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: none;
  border-radius: 8px;
  color: var(--text-light);
  cursor: pointer;
  background: transparent;
  transition: all 0.2s ease;
}

.copy-button.admin-visible {
  display: flex;
}

.copy-button:hover {
  color: var(--text-color);
  background: rgba(0, 0, 0, 0.05);
}

.copy-button:active {
  background: rgba(0, 0, 0, 0.1);
}

.copy-button.copied {
  color: var(--text-color);
}

.copy-button svg {
  width: 18px;
  height: 18px;
}

.support-disclosure {
  max-height: 0;
  overflow: hidden;
  color: var(--text-light);
  font-size: 0.82em;
  line-height: 1.65;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px);
  transition: max-height 0.24s ease, margin-top 0.24s ease, opacity 0.18s ease, transform 0.2s ease;
}

.support-disclosure p {
  margin: 0;
}

.support-disclosure-title {
  margin-bottom: 6px !important;
  color: #8c8c8c;
  font-size: 0.9em;
  font-weight: 800;
  line-height: 1.4;
}

.support-action-hint {
  display: inline-flex;
  margin-top: 9px;
  color: var(--text-color);
  font-size: 0.96em;
  font-weight: 800;
  line-height: 1.4;
}

.support-action-hint::after {
  margin-left: 0.35em;
  content: "↗";
}

.link-item[data-service="buymeacoffee"].support-expanded .link-button {
  border-color: var(--accent-color);
  box-shadow: 4px 4px 0 var(--text-color);
  transform: translate(-2px, -2px);
}

.link-item[data-service="buymeacoffee"].support-expanded .support-disclosure {
  max-height: 168px;
  margin-top: 8px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (min-width: 769px) {
  .link-group {
    max-width: 600px;
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 768px) {
  :root {
    --top-decoration-height: 136px;
    --top-decoration-size: 620px auto;
  }

  body {
    padding: var(--space-3) 20px calc(var(--space-3) + env(safe-area-inset-bottom));
    font-size: 15px;
  }

  .profile {
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    padding: var(--space-3) 0;
    text-align: center;
  }

  .profile img {
    width: 160px;
    height: 160px;
    border-radius: 24px;
  }

  .profile .info h2 {
    font-size: 1.5em;
  }

  .profile .info p {
    font-size: 1em;
  }

  .profile .info .subdued {
    font-size: 0.9em;
  }

  .link-service {
    right: 0;
    bottom: 0;
    font-size: 1.2em;
  }

  .latest-thumbnail-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: -6px;
  }

  .latest-thumbnail:nth-child(n + 5) {
    display: none;
  }

  .latest-image-viewer {
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .latest-image-viewer-panel {
    gap: 12px;
    width: 100%;
  }

  .latest-image-viewer-image-button,
  .latest-image-viewer-image {
    max-width: calc(100vw - 28px);
    max-height: 100%;
  }

  .latest-image-viewer-actions {
    margin-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .link-item[data-service="buymeacoffee"].support-expanded .support-disclosure {
    max-height: 260px;
  }
}

footer {
  --footer-background-size: clamp(900px, 118vw, 1280px) auto;
  --footer-text-padding-top: 32px;
  --footer-text-padding-bottom: 88px;

  width: 100vw;
  margin-top: var(--space-10);
  margin-right: calc(50% - 50vw);
  margin-bottom: 120px;
  margin-left: calc(50% - 50vw);
  padding:
    var(--footer-text-padding-top)
    max(20px, calc((100vw - 720px) / 2 + 20px))
    var(--footer-text-padding-bottom);
  color: #5f5550;
  font-size: 0.9em;
  text-align: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.82)),
    url("/assets/footer.f1566a0f56.webp") center top / var(--footer-background-size) no-repeat;
}

.game-controller {
  position: fixed;
  right: 8px;
  bottom: 8px;
  left: 8px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: env(safe-area-inset-bottom);
  pointer-events: none;
}

.game-controller > * {
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 16px;
  background: white;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.controller-reveal {
  display: none;
}

.dpad {
  display: grid;
  grid-template-columns: 40px 40px 40px;
  grid-template-rows: 40px 40px 40px;
  gap: 4px;
}

.dpad button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  background: var(--text-color);
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.dpad button:hover {
  background: var(--accent-color);
  transform: scale(1.1);
}

.dpad button:active {
  transform: scale(0.95);
}

.dpad-up {
  grid-column: 2;
  grid-row: 1;
}

.dpad-left {
  grid-column: 1;
  grid-row: 2;
}

.dpad-center {
  grid-column: 2;
  grid-row: 2;
  font-size: 12px;
  cursor: pointer;
}

.dpad-right {
  grid-column: 3;
  grid-row: 2;
}

.dpad-down {
  grid-column: 2;
  grid-row: 3;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-a {
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  background: #d26953;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.btn-a:hover {
  background: #bd5f4b;
  transform: scale(1.1);
}

.btn-a:active {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
}

.link-item.controller-selected .link-button {
  border: 2px solid var(--accent-color);
  box-shadow: 4px 4px 0 var(--text-color);
  transform: translate(-2px, -2px);
}

.link-item.controller-selected .link-service {
  color: var(--text-color);
  font-size: 1.5em;
}

.labelled-link-section .link-item.controller-selected .link-service {
  color: #8c8c8c;
  font-size: var(--service-label-size, 1.35em);
}

.sns-section .link-item.controller-selected .link-user {
  color: var(--text-color);
  font-size: var(--link-user-hover-size, 1.5em);
}

.labelled-link-section .link-item.controller-selected .link-label {
  transform: translate(-2px, -2px);
}

.virtual-cursor {
  position: fixed;
  z-index: 9999;
  display: none;
  pointer-events: none;
  transition: all 0.1s ease;
}

.cursor-mode-active .dpad-center {
  color: white;
  background: #4caf50;
}

@media (max-width: 768px) {
  .game-controller {
    right: 0;
    bottom: 8px;
    left: 0;
    min-height: 128px;
    --controller-reveal-width: 20px;
  }

  .dpad,
  .action-buttons {
    transform: scale(0.85);
    transition:
      opacity 0.18s ease,
      transform 0.22s ease;
  }

  .controller-reveal {
    position: fixed;
    bottom: calc(42px + env(safe-area-inset-bottom));
    z-index: 1001;
    display: grid;
    place-items: center;
    width: var(--controller-reveal-width);
    height: 48px;
    padding: 0;
    border: 1px solid rgba(55, 57, 62, 0.36);
    color: rgba(55, 57, 62, 0.48);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 4px 12px rgba(55, 57, 62, 0.08);
    pointer-events: auto;
    transition:
      opacity 0.18s ease,
      transform 0.22s ease,
      border-color 0.2s ease;
  }

  .controller-reveal-left {
    left: 0;
    border-left: none;
    border-radius: 0 10px 10px 0;
  }

  .controller-reveal-right {
    right: 0;
    border-right: none;
    border-radius: 10px 0 0 10px;
  }

  .controller-reveal:active {
    border-color: rgba(55, 57, 62, 0.58);
    color: rgba(55, 57, 62, 0.7);
    transform: scale(0.96);
  }

  .game-controller:not(.controller-collapsed) .controller-reveal {
    opacity: 0;
    pointer-events: none;
  }

  .game-controller.controller-collapsed .dpad {
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(-100% - var(--controller-reveal-width))) scale(0.85);
  }

  .game-controller.controller-collapsed .action-buttons {
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(100% + var(--controller-reveal-width))) scale(0.85);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
