.page-menu {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
}

.page-menu details {
  position: relative;
}

.page-menu summary {
  width: 46px;
  height: 46px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid rgba(92, 61, 31, 0.36);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(132, 92, 48, 0.96) 0%, rgba(86, 58, 32, 0.98) 100%);
  box-shadow: 0 10px 22px rgba(58, 36, 18, 0.22);
  cursor: pointer;
  list-style: none;
}

.page-menu summary::-webkit-details-marker {
  display: none;
}

.page-menu summary span {
  width: 21px;
  height: 2px;
  border-radius: 999px;
  background: #fff7e8;
}

.page-menu-panel {
  position: absolute;
  top: 54px;
  left: 0;
  width: min(82vw, 278px);
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid rgba(118, 78, 40, 0.34);
  border-radius: 16px;
  background: rgba(255, 248, 236, 0.98);
  box-shadow: 0 18px 34px rgba(60, 38, 20, 0.24);
}

.page-menu-panel a {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 10px;
  color: #4b301b;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
}

.page-menu-panel a:hover,
.page-menu-panel a:focus-visible {
  background: rgba(137, 91, 45, 0.12);
}

.individual-title-card {
  position: relative;
  padding-right: 112px !important;
}

.individual-memo-add-button {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 34px;
  border: 1px solid rgba(102, 69, 35, 0.32);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8eb 0%, #ead3b4 100%);
  color: #3f2918;
  box-shadow: 0 6px 14px rgba(58, 36, 18, 0.12);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 6px 12px;
}

.individual-memo-add-button:hover,
.individual-memo-add-button:focus-visible {
  background: #fff4df;
}

.individual-memo-dock-button {
  position: fixed;
  right: 14px;
  bottom: 18px;
  z-index: 45;
  min-height: 42px;
  border: 1px solid rgba(102, 69, 35, 0.32);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8eb 0%, #ead3b4 100%);
  color: #3f2918;
  box-shadow: 0 10px 22px rgba(58, 36, 18, 0.2);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  padding: 8px 14px;
}

.individual-memo-dock-button:hover,
.individual-memo-dock-button:focus-visible {
  background: #fff4df;
}

.individual-memo-panel {
  position: fixed;
  right: 14px;
  bottom: 70px;
  z-index: 46;
  width: min(360px, calc(100vw - 28px));
  max-height: min(520px, calc(100vh - 112px));
  overflow: auto;
  border: 1px solid rgba(102, 69, 35, 0.26);
  border-radius: 16px;
  background: rgba(255, 248, 236, 0.98);
  color: #3f2918;
  box-shadow: 0 18px 36px rgba(58, 36, 18, 0.24);
  padding: 12px;
}

.individual-memo-panel[hidden] {
  display: none !important;
}

.individual-memo-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.individual-memo-panel h2,
.individual-memo-panel h3,
.individual-memo-panel p {
  margin: 0;
}

.individual-memo-panel header button {
  min-height: 32px;
  border: 1px solid rgba(102, 69, 35, 0.28);
  border-radius: 999px;
  background: #fff7e8;
  color: #3f2918;
  font-weight: 800;
  padding: 4px 10px;
}

.individual-memo-panel-list {
  display: grid;
  gap: 8px;
}

.individual-memo-panel-card {
  border: 1px solid rgba(102, 69, 35, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.52);
  padding: 9px;
}

.individual-memo-panel-card p {
  color: #7a5836;
  font-size: 0.76rem;
  font-weight: 800;
}

.individual-memo-panel-card h3 {
  font-size: 0.95rem;
  margin: 2px 0 5px;
}

.individual-memo-panel-card span {
  display: block;
  color: #5a412b;
  font-size: 0.8rem;
  line-height: 1.45;
}

.individual-memo-toast {
  position: fixed;
  right: 14px;
  bottom: 68px;
  z-index: 46;
  max-width: min(78vw, 260px);
  border: 1px solid rgba(102, 69, 35, 0.25);
  border-radius: 12px;
  background: rgba(50, 34, 23, 0.94);
  color: #fff7e8;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 11px;
  box-shadow: 0 10px 22px rgba(58, 36, 18, 0.22);
}

.individual-bottom-nav {
  display: none;
}

@media (max-width: 760px) {
  body {
    padding-bottom: 86px;
  }

  main {
    padding-bottom: 96px !important;
  }

  .individual-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 44;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(92, 61, 31, 0.24);
    background: rgba(255, 247, 234, 0.96);
    box-shadow: 0 -10px 24px rgba(58, 36, 18, 0.16);
    backdrop-filter: blur(10px);
  }

  .individual-bottom-nav a,
  .individual-bottom-nav button {
    min-width: 0;
    min-height: 44px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid rgba(114, 78, 42, 0.2);
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(255, 251, 244, 0.98) 0%, rgba(238, 222, 198, 0.95) 100%);
    color: #4a301c;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.1;
    text-decoration: none;
  }

  .individual-bottom-nav-icon {
    font-size: 1rem;
    line-height: 1;
  }

  .individual-title-card {
    padding-right: 14px !important;
    padding-top: 54px !important;
  }

  .individual-memo-add-button {
    top: 14px;
    right: 14px;
    min-height: 36px;
  }

  .individual-memo-dock-button {
    right: 10px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    min-height: 40px;
    font-size: 0.8rem;
    padding: 7px 12px;
  }

  .individual-memo-toast {
    right: 10px;
    bottom: calc(122px + env(safe-area-inset-bottom));
  }

  .individual-memo-panel {
    left: 10px;
    right: 10px;
    bottom: calc(126px + env(safe-area-inset-bottom));
    width: auto;
    max-height: min(460px, calc(100vh - 160px));
  }
}
