* {
  box-sizing: border-box;
}

:root {
  --bg: #f5efe3;
  --paper: #fffdf8;
  --ink: #3d3429;
  --sub: #756857;
  --green: #557a5c;
  --green-dark: #35543c;
  --line: #d8cbb8;
  --shadow: 0 14px 32px rgba(66, 49, 31, .12);
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.8), transparent 34%),
    linear-gradient(145deg, #f8f3e8, #e9dec9);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}

.studio-shell {
  width: min(1080px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.studio-header {
  text-align: center;
  margin: 8px 0 28px;
}

.brand-kicker {
  margin: 0;
  color: var(--green);
  font-weight: 900;
  letter-spacing: .12em;
}

h1 {
  margin: 4px 0 2px;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  letter-spacing: .06em;
}

.lead {
  margin: 8px 0 0;
  color: var(--sub);
  font-weight: 700;
}

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

.tool-card {
  min-height: 150px;
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 2px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 248, .96);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.active-card:hover,
.active-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--green);
  box-shadow: 0 18px 36px rgba(53, 84, 60, .17);
}

.active-card:active {
  transform: scale(.985);
}

.tool-mark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: #edf4ee;
  color: var(--green-dark);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 2rem;
  font-weight: 900;
}

.tool-card h2 {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
}

.tool-card p {
  margin: 0;
  color: var(--sub);
  line-height: 1.55;
}

.open-label {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--green-dark);
  color: #fff;
  font-weight: 900;
  white-space: nowrap;
}

.preparing {
  opacity: .68;
  box-shadow: none;
}

.preparing .open-label {
  background: #b8aa97;
}

.studio-footer {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.back-home {
  color: var(--sub);
  font-weight: 800;
  text-underline-offset: .2em;
}

@media (max-width: 760px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-card {
    min-height: 124px;
    grid-template-columns: 62px 1fr auto;
    padding: 18px;
  }

  .tool-mark {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    font-size: 1.65rem;
  }
}

@media (max-width: 520px) {
  .tool-card {
    grid-template-columns: 54px 1fr;
  }

  .open-label {
    grid-column: 2;
    width: fit-content;
    margin-top: 4px;
  }
}

@media (orientation: landscape) and (max-height: 650px) {
  .studio-shell {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .studio-header {
    margin-bottom: 14px;
  }

  h1 {
    font-size: 3rem;
  }

  .tool-card {
    min-height: 108px;
    padding: 14px 18px;
  }

  .tool-mark {
    width: 54px;
    height: 54px;
    font-size: 1.55rem;
  }

  .studio-footer {
    margin-top: 14px;
  }
}


/* KanjiStudio v2 */
.tool-grid {
  width: min(920px, 100%);
  margin: 0 auto;
  grid-template-columns: 1fr;
  gap: 18px;
}

.tool-card {
  min-height: 168px;
  grid-template-columns: 88px 1fr auto;
  padding: 26px 30px;
}

.tool-mark {
  width: 78px;
  height: 78px;
  font-size: 2.2rem;
}

.tool-card h2 {
  font-size: clamp(1.6rem, 3.3vw, 2.2rem);
}

.tool-card p {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
}

@media (orientation: landscape) and (max-height: 700px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 1040px;
  }

  .tool-card {
    min-height: 210px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 10px;
    padding: 18px;
  }

  .tool-mark {
    width: 64px;
    height: 64px;
    font-size: 1.8rem;
  }

  .open-label {
    margin-top: 4px;
  }
}
