/* Desktop-only grouping boxes dissolve into the existing mobile flow. */
.game-guide, .calls-side-tools, .voices-form-fields, .voices-form-feedback { display:contents; }
/* v18.8: optional game sound control; existing responsive layouts retained. */
#gamePage .game-sound-toggle {
  display:inline-flex; align-items:center; justify-content:center;
  min-width:78px; min-height:34px; margin:8px 0 0; padding:5px 12px;
  border:1px solid #e4b9ce; border-radius:999px; background:#fff5fa;
  color:#8b4567; font-size:12px; font-weight:700; line-height:1.4; white-space:nowrap;
}
#gamePage .game-sound-toggle[aria-pressed=true] { background:#f9ddeb; border-color:#dd82ac; color:#9d3262; }
#gamePage .game-sound-toggle:hover { border-color:#cb6092; }
html { scroll-padding-top: 86px; }
.app-wrap { padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px)); }
.tabs.tabs-four {
  position: fixed; top: auto; bottom: max(9px, env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%); z-index: 100;
  width: min(960px, calc(100vw - 24px)); margin: 0;
  box-sizing: border-box; grid-template-columns: repeat(4,minmax(0,1fr));
  background: rgba(255,244,250,.98); box-shadow: 0 6px 25px #b94a8652, 0 1px 2px #fff inset;
}
.tabs-four .tab { min-width: 0; }
/* For the community page, the decorative top bow should not consume a full row. */
body.is-voices-tab .masthead { height: 44px; }
body.is-voices-tab .masthead img { width: 200px; height: 65px; max-width: none; transform: translateY(-13px); }

#voicesPage { padding: 1px 0 12px; }
#voicesListScreen.voices-panel { max-width: 1020px; padding: 11px 17px 20px; border-radius: 22px; }
#voicesListScreen.voices-panel::after { inset: 6px; border-width: 10px; border-image-width:10px; opacity: .28; }
#voicesListScreen .voices-list-header {
  position:sticky; top:0; z-index:30;
  margin:-11px -17px 6px; padding:11px 17px 6px;
  background:#fffafd; border-bottom:1px solid #f4d5e5;
  border-radius:19px 19px 0 0; box-shadow:0 4px 8px #c2699014;
}
#voicesListScreen .voices-heading { margin: 0 auto 4px; padding: 0 6px 4px; gap: 14px; justify-content: center; }
#voicesListScreen .voices-heading h1 { margin: 0 0 2px; font-size: clamp(23px, 3vw, 28px); line-height: 1.25; gap: 5px; }
#voicesListScreen .voices-heading p { font-size: 11px; line-height: 1.35; }
#voicesListScreen .voices-portrait-frame { flex-basis: 73px; width: 73px; border-width: 4px; }
#voicesListScreen .voices-portrait-frame::before { inset:-7px; border-width: 2px; }
#voicesListScreen .voices-portrait-bow { width: 49px; height:22px; bottom:-12px; }
/* Filters and comment button are always one line, no floating caption underneath. */
#voicesListScreen .voices-sticky-actions {
  position:static; top:auto; z-index:auto; margin: 2px 0 6px; padding: 5px 6px;
  border: 1px solid #f5daea; border-radius: 15px; background: rgba(255,250,253,.98);
  box-shadow: 0 3px 8px #c2699012;
}
#voicesListScreen .voices-filters {
  display: grid; grid-template-columns: 0.75fr 1.05fr 1fr 1.62fr 1.05fr;
  align-items: center; gap: 4px; margin: 0 0 5px;
}
#voicesListScreen .voices-filters > * { grid-column: auto; min-width:0; }
#voicesListScreen .voice-filter, #voicesListScreen .voices-comment-action .voices-primary {
  width:100%; min-width:0; min-height:34px; padding: 5px 4px;
  font-size: clamp(10px, 1.5vw, 12px); line-height: 1.3; white-space: nowrap; gap: 3px;
  box-sizing: border-box;
}
#voicesListScreen .voices-filters .icon { display:none; }
#voicesListScreen .voices-comment-action { grid-column:auto; min-width:0; }
#voicesListScreen .voices-comment-action .voices-primary { border-width: 1px; box-shadow: none; }
#voicesListScreen .voices-comment-hint { display:none; }
#voicesListScreen .voices-toolbar { display:flex; flex-wrap:nowrap; margin:0; gap:5px; align-items:center; font-size:12px; }
#voicesListScreen .voices-toolbar > p { flex: 0 0 auto; white-space:nowrap; margin:0; font-size:12px; }
#voicesListScreen .voices-list-settings { flex: 1 1 auto; width:auto; min-width:0; gap:6px; justify-content:flex-end; }
#voicesListScreen .voices-page-size, #voicesListScreen .voices-sort { gap:3px; min-width:0; font-size:11px; }
#voicesListScreen #voicesPageSize, #voicesListScreen #voicesSort {
  min-width:0; width:auto; min-height:32px; max-width:none; border-width:1px;
  padding:4px 17px 4px 7px; font-size:12px; line-height: 1.3;
}
#voicesListScreen .voices-sort > span { display:none; }
#voicesListScreen .voices-list { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; padding: 2px 0; }
#voicesListScreen .voice-card { min-width:0; min-height:113px; padding: 9px 10px 29px; border-radius:12px; }
#voicesListScreen .voice-card::before { border-image-width:7px; }
#voicesListScreen .voice-card::after { opacity:.52; width:25px; height:25px; right:7px; top:23px; }
#voicesListScreen .voice-card:nth-child(4n+1)::after { width:32px; height:18px; top:-5px; right:5px; }
#voicesListScreen .voice-card-head { margin:0 0 3px; }
#voicesListScreen .voice-category { padding:2px 7px; font-size:10px; line-height:1.3; }
#voicesListScreen .voice-meta { margin-top:2px; padding-right:13px; gap:2px 5px; font-size:10px; }
#voicesListScreen .voice-meta time { font-size:9px; }
#voicesListScreen .voice-card-body { display:block; min-height:0; flex:none; }
#voicesListScreen .voice-copy { padding:0; }
#voicesListScreen .voice-comment { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; max-width:100%; margin:3px 0 0; font-size:13px; line-height:1.5; }
#voicesListScreen .voice-card.is-expanded .voice-comment { display:block; overflow:visible; -webkit-line-clamp:unset; }
#voicesListScreen .voice-song { font-size:10px; line-height:1.3; padding:1px 5px; margin:0; }
#voicesListScreen .voice-expand { position:absolute; bottom:8px; left:10px; padding:3px 2px; background:transparent; border:0; color:#be4b80; font-weight:700; font-size:10px; line-height:1.3; text-decoration:underline; text-underline-offset:2px; }
#voicesListScreen .voice-like { position:absolute; bottom:5px; right:9px; min-width:38px; min-height:29px; padding:4px 6px; margin:0; font-size:11px; }
#voicesListScreen .voice-like .icon { width:15px; height:15px; }
#voicesList { scroll-margin-top:100px; }
#voicesListScreen .voices-pagination { margin-top: 13px; }

@media(max-width:700px) {
  .app-wrap { padding-left:9px; padding-right:9px; padding-bottom: calc(87px + env(safe-area-inset-bottom,0px)); }
  .tabs.tabs-four { bottom: max(5px, env(safe-area-inset-bottom,0px)); width:calc(100vw - 14px); padding:3px; gap:2px; border-width:2px; border-radius:20px; }
  .tabs-four .tab { min-height:56px; padding:3px 2px; gap:2px; font-size:10px; border-radius:16px; }
  .tabs-four .tab .icon { width:19px; height:19px; }
  body.is-voices-tab .masthead { height:32px; }
  body.is-voices-tab .masthead img { width:150px; height:48px; transform:translateY(-10px); }
  #voicesPage { padding:0; }
  #voicesListScreen.voices-panel { padding:8px 9px 13px; border-radius:17px; border-width:2px; }
  #voicesListScreen.voices-panel::after { inset:3px; border-width:8px; border-image-width:8px; }
  #voicesListScreen .voices-list-header {
    margin:-8px -9px 4px; padding:8px 9px 5px; border-radius:15px 15px 0 0;
  }
  #voicesListScreen .voices-heading { justify-content:space-between; gap:10px; padding:0 3px 4px; }
  #voicesListScreen .voices-heading h1 { font-size:22px; white-space:nowrap; }
  #voicesListScreen .voices-heading p { max-width:235px; font-size:10px; line-height:1.4; }
  #voicesListScreen .voices-heading p span { display:inline; white-space:normal; }
  #voicesListScreen .voices-portrait-frame { flex-basis:64px; width:64px; border-width:3px; }
  #voicesListScreen .voices-sticky-actions { margin:0 0 4px; padding:4px 3px; border-radius:12px; }
  #voicesListScreen .voices-filters { gap:2px; margin-bottom:4px; }
  #voicesListScreen .voice-filter, #voicesListScreen .voices-comment-action .voices-primary {
    min-height:32px; padding:3px 1px; font-size:clamp(8px,2.4vw,10px); letter-spacing:-.035em; border-width:1px;
  }
  #voicesListScreen .voices-toolbar { gap:3px; font-size:10px; }
  #voicesListScreen .voices-toolbar > p { flex-basis:auto; font-size:10px; }
  #voicesListScreen .voices-list-settings { width:auto; gap:3px; justify-content:flex-end; }
  #voicesListScreen .voices-page-size { font-size:10px; gap:2px; }
  #voicesListScreen #voicesPageSize, #voicesListScreen #voicesSort { min-height:28px; padding:3px 13px 3px 5px; font-size:10px; }
  #voicesListScreen .voices-list { gap:7px; }
  #voicesListScreen .voice-card { min-height:117px; padding:7px 7px 29px; border-radius:10px; }
  #voicesListScreen .voice-card-head { margin-bottom:1px; }
  #voicesListScreen .voice-category { max-width:100%; font-size:9px; padding:2px 4px; }
  #voicesListScreen .voice-category .icon { display:none; }
  #voicesListScreen .voice-meta { margin-top:2px; padding-right:0; font-size:9px; gap:0 4px; }
  #voicesListScreen .voice-meta time { font-size:8px; }
  #voicesListScreen .voice-comment { font-size:12px; line-height:1.48; }
  #voicesListScreen .voice-expand { font-size:10px; left:7px; bottom:7px; }
  #voicesListScreen .voice-like { right:6px; bottom:4px; min-height:28px; min-width:34px; padding:4px; font-size:10px; }
  #voicesListScreen .voice-card::after { display:none; }
}
@media(max-width:360px) {
  #voicesListScreen.voices-panel { padding-left:7px; padding-right:7px; }
  #voicesListScreen .voices-list-header { margin-inline:-7px; padding-inline:7px; }
  #voicesListScreen .voices-heading h1 { font-size:20px; }
  #voicesListScreen .voices-heading p { font-size:9px; }
  #voicesListScreen .voices-portrait-frame { flex-basis:53px; width:53px; }
  #voicesListScreen .voices-filters { grid-template-columns:.73fr 1fr 1fr 1.57fr 1.02fr; gap:1px; }
  #voicesListScreen .voice-filter, #voicesListScreen .voices-comment-action .voices-primary { font-size:8px; padding-inline:0; }
  #voicesListScreen .voice-comment { font-size:11.5px; }
  #voicesListScreen .voices-page-size > span { display:none; }
  #voicesListScreen .voice-category { font-size:8px; }
}
/* Anchor the read-more/like controls to the card, not to its text body. */
#voicesListScreen .voice-card-body { position: static; }
/* Three readable rows (roughly six comments) in a typical phone viewport. */
#voicesListScreen .voice-card { min-height: 142px; }
#voicesListScreen .voice-comment { -webkit-line-clamp: 3; font-size:13px; line-height:1.5; }
@media(max-width:700px) {
  #voicesListScreen .voice-card { min-height: 142px; }
  #voicesListScreen .voice-comment { font-size:13px; line-height:1.5; }
  #voicesListScreen .voice-meta { font-size:10px; }
  #voicesListScreen .voice-category { font-size:9.5px; }
}
@media(max-width:360px) {
  #voicesListScreen .voice-card { min-height: 139px; }
  #voicesListScreen .voice-comment { font-size:12px; }
}

/* Small screens: top tabs with a solid backdrop and space for the pinned voices header. */
@media (max-width:1023px) {
  :root {
    --top-nav-inset:max(5px, env(safe-area-inset-top, 0px));
    --top-nav-offset:calc(var(--top-nav-inset) + 72px);
  }
  html { scroll-padding-top:var(--top-nav-offset); }
  body::before {
    content:''; position:fixed; top:0; right:0; left:0;
    height:var(--top-nav-offset); z-index:99;
    background:#fff5fb; pointer-events:none;
  }
  .app-wrap {
    padding-top:var(--top-nav-offset);
    padding-bottom:calc(25px + env(safe-area-inset-bottom, 0px));
  }
  .skip-link { z-index:101; }
  .tabs.tabs-four {
    top:var(--top-nav-inset); bottom:auto;
    height:66px; width:calc(100vw - 14px); padding:3px; border-width:2px;
    background:#fff4fa; box-shadow:0 3px 8px #b94a8624;
  }
  .tabs-four .tab { min-height:56px; }
  #voicesListScreen .voices-list-header { display:contents; }
  #voicesListScreen .voices-heading { position:relative; z-index:1; }
  #voicesListScreen #voicesListActions {
    position:sticky; top:var(--top-nav-offset); z-index:30;
    background:#fffafd; box-shadow:0 4px 8px #c2699014;
  }
}

/* Phone comments: smaller type and less empty space, with clear room for the actions. */
@media (max-width:700px) {
  #voicesListScreen .voices-list { gap:6px; }
  #voicesListScreen .voice-card { min-height:120px; padding:6px 6px 32px; }
  #voicesListScreen .voice-card::before { border-image-width:6px; }
  #voicesListScreen .voice-card-head { margin-bottom:1px; }
  #voicesListScreen .voice-category { font-size:8.5px; padding:1px 4px; line-height:1.3; }
  #voicesListScreen .voice-meta { margin-top:1px; gap:0 4px; font-size:9px; line-height:1.3; }
  #voicesListScreen .voice-author { line-height:1.3; }
  #voicesListScreen .voice-meta time { font-size:8px; line-height:1.3; }
  #voicesListScreen .voice-song { font-size:9px; line-height:1.25; padding:1px 4px; }
  #voicesListScreen .voice-comment { margin-top:2px; font-size:12px; line-height:1.35; }
  #voicesListScreen .voice-expand { left:6px; bottom:5px; font-size:9.5px; }
  #voicesListScreen .voice-like { right:5px; bottom:3px; }
}

/* Desktop: a full-height sidebar anchored to the upper-left corner. */
@media (min-width:1024px) {
  body { padding-left:212px; }
  .app-wrap { padding-bottom:40px; }
  .skip-link { z-index:101; }
  .tabs.tabs-four {
    top:0; bottom:0; left:0; transform:none;
    width:212px; max-height:none;
    grid-template-columns:minmax(0,1fr); grid-auto-rows:max-content;
    align-content:start; gap:8px; padding:24px 14px;
    border:0; border-right:1px solid #eedbe5; border-radius:0;
    background:#fffafd; box-shadow:none; backdrop-filter:none;
    overflow-y:auto; overscroll-behavior:contain;
  }
  .tabs-four .tab {
    position:relative; flex-direction:row; justify-content:flex-start; gap:12px;
    min-height:54px; padding:12px; border-radius:12px;
    border:1px solid transparent; background:transparent; box-shadow:none; color:#70485e;
    font-size:14px; line-height:1.4; white-space:nowrap;
  }
  .tabs-four .tab:hover { background:#fbedf4; color:#9d3767; }
  .tabs-four .tab[aria-selected=true] {
    background:#f9e0ed; border-color:#f0c5d9; color:#a82f65; box-shadow:none;
  }
  .tabs-four .tab[aria-selected=true]::before {
    content:''; position:absolute; left:0; top:13px; bottom:13px;
    width:3px; border-radius:0 3px 3px 0; background:#d94c88;
  }
  .tabs-four .tab[aria-selected=true]:hover { background:#f6d6e7; }
  .tabs-four .tab .icon { width:22px; height:22px; }
  .tabs-four .calls-tab-label { display:inline-flex; flex-wrap:nowrap; }

  /* Keep the bow and voices controls together while showing ten posts in two rows. */
  body.is-voices-tab { --voices-bow-height:60px; }
  body.is-voices-tab .app-wrap { width:100%; max-width:1440px; padding-inline:20px; }
  body.is-voices-tab .masthead {
    position:sticky; top:0; z-index:31; height:var(--voices-bow-height);
    background:#fff5fb;
  }
  body.is-voices-tab .masthead img { width:180px; height:60px; transform:none; }
  #voicesListScreen.voices-panel { max-width:none; }
  #voicesListScreen .voices-list-header { top:var(--voices-bow-height); padding-top:8px; }
  #voicesListScreen .voices-heading { padding-top:0; padding-bottom:3px; }
  #voicesListScreen .voices-heading h1 { font-size:26px; }
  #voicesListScreen .voices-portrait-frame { flex-basis:56px; width:56px; border-width:3px; }
  #voicesListScreen .voices-portrait-bow { width:42px; height:18px; bottom:-10px; }
  #voicesListScreen .voices-sticky-actions { padding-block:4px; }
  #voicesListScreen .voices-filters { margin-bottom:4px; }
  #voicesListScreen .voice-filter,
  #voicesListScreen .voices-comment-action .voices-primary { min-height:30px; padding-block:4px; }
  #voicesListScreen #voicesPageSize,
  #voicesListScreen #voicesSort { min-height:28px; padding-block:3px; }
  #voicesListScreen .voices-list { grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; padding:4px 0; }
  #voicesListScreen .voice-card { min-height:176px; padding:10px 9px 33px; }
  #voicesListScreen .voice-card::after { display:none; }
  #voicesListScreen .voice-card-head { margin-bottom:4px; }
  #voicesListScreen .voice-category { font-size:10px; padding:2px 6px; }
  #voicesListScreen .voice-category .icon { display:none; }
  #voicesListScreen .voice-meta { flex-wrap:nowrap; padding-right:0; margin-top:4px; gap:4px; }
  #voicesListScreen .voice-author {
    display:block; flex:1 1 auto; min-width:0;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  #voicesListScreen .voice-song {
    display:block; min-width:0; padding:2px 5px; line-height:1.4;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  #voicesListScreen .voice-card.is-expanded .voice-author,
  #voicesListScreen .voice-card.is-expanded .voice-song { white-space:normal; overflow:visible; overflow-wrap:anywhere; }
}

/* v18.17: Mobile voices introduction — the tab already says "みんなの声".
   Hide its repeated visual heading, enlarge the portrait and readable lead copy.
   The desktop layout and sticky filters remain unchanged. */
@media (max-width:700px) {
  #voicesListScreen .voices-heading {
    align-items:center; justify-content:space-between; gap:13px;
    padding:10px 5px 13px; margin-bottom:4px; text-align:left;
  }
  #voicesListScreen .voices-heading h1 {
    position:absolute; width:1px; height:1px; padding:0; margin:-1px;
    overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0;
  }
  #voicesListScreen .voices-heading-copy { flex:1 1 0; min-width:0; }
  #voicesListScreen .voices-heading p {
    max-width:none; font-size:13px; font-weight:700; line-height:1.65;
    letter-spacing:.005em; overflow-wrap:anywhere; text-wrap:pretty;
  }
  #voicesListScreen .voices-portrait-frame {
    flex:0 0 96px; width:96px; height:96px; border-width:4px;
  }
  #voicesListScreen .voices-portrait-bow { width:61px; height:26px; bottom:-15px; }
}
@media (max-width:360px) {
  #voicesListScreen .voices-heading { gap:9px; padding-inline:3px; }
  #voicesListScreen .voices-heading p { font-size:12px; line-height:1.6; }
  #voicesListScreen .voices-portrait-frame { flex-basis:86px; width:86px; height:86px; }
  #voicesListScreen .voices-portrait-bow { width:56px; height:24px; bottom:-13px; }
}

/* v18.17: home readability polish. Keep these overrides phone-only. */
@media (max-width:640px) {
  #homePage .home-title {
    top:12px; left:1px; width:140px; max-width:39vw;
    text-align:left; filter:drop-shadow(0 2px 4px #c9468799);
  }
  #homePage .home-title > .icon { width:26px; height:21px; margin:0 0 1px 8px; }
  #homePage .home-title h1 {
    font-size:clamp(35px,10.55vw,42px); line-height:.94;
    letter-spacing:-.028em; text-shadow:0 2px 1px #9e256b66;
  }
  #homePage .home-title .name-line {
    justify-content:flex-start; padding-left:4px; gap:2px;
  }
  #homePage .home-title .name-line .icon { font-size:18px; }
  #homePage .profile-name {
    font-size:21px; line-height:1.45; margin-bottom:12px;
  }
}
@media (max-width:375px) {
  #homePage .home-title {top:11px;left:1px;width:130px;max-width:40vw;}
  #homePage .home-title h1 {font-size:clamp(34px,10.5vw,39px);}
  #homePage .profile-name {font-size:20px;}
}
