:root {
  color: #183321;
  background: #8fd0ef;
  font-family:
    "Courier New", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, monospace;
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  margin: 0;
  background:
    linear-gradient(#7dccf1 0 27%, transparent 27%),
    linear-gradient(90deg, transparent 0 8%, rgba(255, 255, 255, 0.88) 8% 13%, transparent 13% 100%),
    linear-gradient(90deg, transparent 0 72%, rgba(255, 255, 255, 0.74) 72% 78%, transparent 78% 100%),
    linear-gradient(#9bdf75 0 0) bottom / 100% 72px no-repeat,
    #ccefb5;
  image-rendering: pixelated;
}

body::before {
  position: fixed;
  inset: auto 0 0;
  height: 72px;
  content: "";
  background:
    linear-gradient(90deg, #5f9f45 0 12px, transparent 12px 24px) 0 22px / 24px 14px repeat-x,
    linear-gradient(90deg, #497437 0 18px, transparent 18px 38px) 0 48px / 38px 12px repeat-x;
  pointer-events: none;
}

a {
  color: inherit;
}

.phone-shell {
  position: relative;
  display: grid;
  width: min(1180px, calc(100% - 28px));
  min-height: calc(100svh - 28px);
  margin: 14px auto;
  padding: 28px;
  align-content: start;
  gap: 18px;
  background: #d8edbd;
  border: 5px solid #17331f;
  box-shadow:
    0 0 0 6px #6b8754,
    0 0 0 10px #f4ffd9,
    12px 12px 0 rgba(21, 48, 31, 0.28);
}

.phone-shell::before,
.phone-shell::after {
  position: absolute;
  width: 14px;
  height: 14px;
  content: "";
  background: #6b8754;
  box-shadow:
    0 0 0 2px #17331f,
    18px 0 0 #d8edbd,
    18px 0 0 2px #17331f,
    0 18px 0 #d8edbd,
    0 18px 0 2px #17331f;
}

.phone-shell::before {
  top: 14px;
  left: 14px;
}

.phone-shell::after {
  right: 14px;
  bottom: 14px;
  transform: rotate(180deg);
}

.status-area,
.works-panel,
.about-panel,
.pets-panel,
.pixel-controls {
  position: relative;
  z-index: 1;
}

.status-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 18px;
  color: #eaffd0;
  background:
    linear-gradient(180deg, #153d26 0%, #0d2b1b 100%);
  border: 4px solid #102619;
  box-shadow:
    inset 0 0 0 4px #2f653d,
    0 6px 0 #7b9a5e;
}

.clock {
  margin: 0 0 8px;
  color: #f3ffe0;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

h1 {
  margin: 0;
  color: #f7ffd7;
  font-size: 34px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0;
}

.profile-copy {
  margin: 8px 0 0;
  color: #bfe2a4;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 800;
}

.profile-link {
  display: inline-grid;
  width: 76px;
  height: 76px;
  place-items: center;
  background: #86bc4e;
  border: 4px solid #f4ffd9;
  box-shadow:
    0 0 0 4px #142a1b,
    inset -6px -6px 0 rgba(19, 45, 27, 0.26);
  text-decoration: none;
}

.profile-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #f7ffd7;
  background: #3a823f;
  border: 3px solid #17331f;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 4px 4px 0 rgba(255, 255, 255, 0.26);
}

.works-panel {
  padding: 22px 24px 24px;
  background: #fff4c8;
  border: 4px solid #17331f;
  box-shadow:
    inset 0 0 0 4px #f4d88b,
    0 6px 0 #6b8754;
}

.works-panel h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 0 22px;
  color: #17331f;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
}

.works-panel h2 span {
  color: #f2a51e;
  text-shadow: 2px 2px 0 #7f5c1f;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.app-link {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  color: #17331f;
  text-align: center;
  text-decoration: none;
}

.app-icon {
  position: relative;
  display: grid;
  width: 184px;
  max-width: 100%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  background: var(--accent);
  border: 4px solid #132719;
  box-shadow:
    0 0 0 4px #f5ffd9,
    8px 8px 0 rgba(20, 46, 29, 0.22);
}

.app-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.app-link:hover .app-icon,
.app-link:focus-visible .app-icon {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 4px #fff6a3,
    8px 12px 0 rgba(20, 46, 29, 0.28);
}

.app-link:focus-visible {
  outline: 4px solid #f2a51e;
  outline-offset: 8px;
}

.app-title {
  max-width: 190px;
  overflow-wrap: anywhere;
  color: #17331f;
  font-size: 18px;
  line-height: 1.12;
  font-weight: 900;
}

.app-subtitle {
  max-width: 210px;
  min-height: 2.5em;
  color: #415c37;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 800;
}

.about-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  background: #cfe7b4;
  border: 4px solid #17331f;
  box-shadow:
    inset 0 0 0 4px #e6f8cb,
    0 6px 0 #6b8754;
}

.about-mascot {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  background: #fff4c8;
  border: 4px solid #17331f;
  background-image: url("./assets/works/about-mascot-pixel.png");
  background-position: center;
  background-size: cover;
  image-rendering: pixelated;
}

.about-panel h2 {
  margin: 0 0 8px;
  color: #17331f;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 900;
}

.about-panel p {
  margin: 0;
  color: #31512d;
  font-size: 15px;
  line-height: 1.75;
  font-weight: 800;
}

.pets-panel {
  padding: 18px 22px 20px;
  background: #fff4c8;
  border: 4px solid #17331f;
  box-shadow:
    inset 0 0 0 4px #f4d88b,
    0 6px 0 #6b8754;
}

.pets-panel h2 {
  margin: 0 0 16px;
  color: #17331f;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 900;
}

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

.pet-card {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  padding: 8px 6px;
  background: #d8edbd;
  border: 3px solid #17331f;
  box-shadow:
    inset 0 0 0 3px #e9f8ce,
    4px 4px 0 rgba(20, 46, 29, 0.18);
  text-align: center;
}

.pet-icon {
  display: block;
  width: 88px;
  max-width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #e6f8cb;
  border: 3px solid #17331f;
}

.pet-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.pet-name {
  color: #17331f;
  font-size: 15px;
  line-height: 1.05;
  font-weight: 900;
}

.pet-color {
  color: #46623a;
  font-size: 10px;
  line-height: 1.15;
  font-weight: 800;
}

.pixel-controls {
  display: grid;
  grid-template-columns: 80px minmax(80px, 1fr) 118px;
  align-items: center;
  gap: 22px;
  margin-top: 6px;
}

.dpad {
  position: relative;
  width: 72px;
  height: 72px;
}

.dpad::before,
.dpad::after {
  position: absolute;
  content: "";
  background: #183321;
}

.dpad::before {
  top: 24px;
  left: 0;
  width: 72px;
  height: 24px;
}

.dpad::after {
  top: 0;
  left: 24px;
  width: 24px;
  height: 72px;
}

.dot-line {
  height: 10px;
  background:
    linear-gradient(90deg, #78975b 0 10px, transparent 10px 20px) center / 20px 10px repeat-x;
}

.button-pair {
  display: flex;
  justify-content: end;
  gap: 16px;
}

.button-pair i {
  width: 46px;
  height: 24px;
  background: #df3f28;
  border: 4px solid #183321;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.34);
}

@media (max-width: 900px) {
  .phone-shell {
    width: min(720px, calc(100% - 22px));
    padding: 22px;
  }

  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 18px;
  }

  .app-icon {
    width: 164px;
  }

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

@media (max-width: 560px) {
  body {
    background:
      linear-gradient(#7dccf1 0 24%, transparent 24%),
      linear-gradient(#9bdf75 0 0) bottom / 100% 56px no-repeat,
      #ccefb5;
  }

  .phone-shell {
    width: calc(100% - 18px);
    min-height: calc(100svh - 18px);
    margin: 9px auto;
    padding: 14px;
    gap: 14px;
    border-width: 4px;
    box-shadow:
      0 0 0 4px #6b8754,
      0 0 0 7px #f4ffd9,
      7px 7px 0 rgba(21, 48, 31, 0.22);
  }

  .phone-shell::before,
  .phone-shell::after {
    display: none;
  }

  .status-area {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px;
    border-width: 3px;
    box-shadow:
      inset 0 0 0 3px #2f653d,
      0 4px 0 #7b9a5e;
  }

  .clock {
    margin-bottom: 5px;
    font-size: 16px;
  }

  h1 {
    font-size: 23px;
  }

  .profile-copy {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
  }

  .profile-link {
    width: 56px;
    height: 56px;
    border-width: 3px;
    box-shadow:
      0 0 0 3px #142a1b,
      inset -4px -4px 0 rgba(19, 45, 27, 0.26);
  }

  .profile-mark {
    width: 36px;
    height: 36px;
    border-width: 2px;
    font-size: 23px;
  }

  .works-panel {
    padding: 16px 12px 18px;
    border-width: 3px;
    box-shadow:
      inset 0 0 0 3px #f4d88b,
      0 4px 0 #6b8754;
  }

  .works-panel h2 {
    gap: 9px;
    margin-bottom: 16px;
    font-size: 19px;
  }

  .app-grid {
    gap: 20px 12px;
  }

  .app-icon {
    width: min(132px, 100%);
    border-width: 3px;
    box-shadow:
      0 0 0 3px #f5ffd9,
      5px 5px 0 rgba(20, 46, 29, 0.2);
  }

  .app-title {
    max-width: 150px;
    font-size: 14px;
  }

  .app-subtitle {
    max-width: 156px;
    min-height: 2.6em;
    font-size: 10px;
  }

  .about-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
    border-width: 3px;
    box-shadow:
      inset 0 0 0 3px #e6f8cb,
      0 4px 0 #6b8754;
  }

  .about-mascot {
    width: 48px;
    height: 48px;
    border-width: 3px;
  }

  .about-panel h2 {
    font-size: 20px;
  }

  .about-panel p {
    font-size: 12px;
    line-height: 1.65;
  }

  .pets-panel {
    padding: 14px 12px 16px;
    border-width: 3px;
    box-shadow:
      inset 0 0 0 3px #f4d88b,
      0 4px 0 #6b8754;
  }

  .pets-panel h2 {
    margin-bottom: 12px;
    font-size: 20px;
  }

  .pet-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
  }

  .pet-card {
    padding: 7px 4px;
    border-width: 3px;
    box-shadow:
      inset 0 0 0 2px #e9f8ce,
      3px 3px 0 rgba(20, 46, 29, 0.16);
  }

  .pet-icon {
    width: 68px;
    border-width: 3px;
  }

  .pet-name {
    font-size: 13px;
  }

  .pet-color {
    font-size: 9px;
  }

  .pixel-controls {
    grid-template-columns: 54px minmax(50px, 1fr) 82px;
    gap: 12px;
  }

  .dpad {
    width: 48px;
    height: 48px;
  }

  .dpad::before {
    top: 16px;
    width: 48px;
    height: 16px;
  }

  .dpad::after {
    left: 16px;
    width: 16px;
    height: 48px;
  }

  .button-pair {
    gap: 10px;
  }

  .button-pair i {
    width: 32px;
    height: 18px;
    border-width: 3px;
  }
}
