/* Fish console refresh: KB Potato is a compact, low-profile fish-at-work console. */

.site-header,
.game-section,
.toolbox-section,
.community-section {
  width: min(1260px, calc(100vw - 32px));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: 10px;
}

.module-bar {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(260px, 1fr) auto;
  align-items: center;
  border-radius: 12px;
  background: rgba(13, 43, 40, 0.94);
  color: #fff8e8;
  box-shadow: 0 16px 36px rgba(6, 20, 18, 0.18);
  backdrop-filter: blur(14px);
}

.module-brand {
  border-radius: 8px;
  background: #f4a527;
  color: #221303;
}

.module-current {
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  color: #fff8e8;
}

.module-nav {
  justify-content: center;
}

.module-nav a,
.module-nav span,
.stealth-nav button,
.mode-chip {
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 248, 232, 0.82);
}

.module-nav .active {
  border-color: rgba(244, 165, 39, 0.68);
  background: rgba(244, 165, 39, 0.18);
  color: #ffe7ab;
}

.stealth-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.stealth-nav button,
.mode-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.stealth-nav button:hover,
.fish-actions button:hover,
.stealth-actions button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.mode-chip {
  border-color: rgba(117, 185, 171, 0.35);
  background: rgba(17, 133, 108, 0.24);
  color: #c9fff2;
}

.section-head {
  grid-template-columns: minmax(0, 1fr) minmax(350px, 430px);
  gap: 18px;
  min-height: 360px;
  padding: 22px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(135deg, #102b28 0%, #0b453b 58%, #31210f 100%);
}

.section-head::after {
  display: none;
}

.fish-console {
  display: grid;
  align-content: center;
  min-width: 0;
}

.fish-console h1 {
  max-width: 820px;
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 64px);
}

.fish-console .section-copy {
  max-width: 820px;
  color: rgba(255, 248, 232, 0.8);
  font-size: 16px;
}

.fish-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 14px;
}

.fish-actions button {
  min-width: 0;
  min-height: 88px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff8e8;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.fish-actions strong,
.fish-actions span {
  display: block;
}

.fish-actions strong {
  margin-bottom: 8px;
  font-size: 17px;
}

.fish-actions span {
  color: rgba(255, 248, 232, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.connection-box {
  display: grid;
  gap: 12px;
  align-content: start;
  background: rgba(4, 18, 17, 0.56);
}

.stealth-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(244, 165, 39, 0.22);
  border-radius: 12px;
  background: rgba(244, 165, 39, 0.1);
}

.panel-label {
  display: block;
  margin-bottom: 4px;
  color: #f9d592;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.stealth-panel strong {
  color: #fff8e8;
}

.stealth-hint {
  display: block;
  margin-top: 6px;
  color: rgba(255, 248, 232, 0.7);
  font-size: 12px;
  line-height: 1.45;
}

.stealth-actions,
.room-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stealth-actions button,
.room-actions button,
.bot-toggle {
  justify-content: center;
  min-width: 0;
  min-height: 38px;
  border-radius: 10px;
  white-space: normal;
}

.connection-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.connection-box input {
  min-width: 0;
}

.connection-status {
  min-height: 34px;
}

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

.game-overview div {
  min-width: 0;
  min-height: 86px;
}

.game-overview strong {
  font-size: 19px;
}

.game-overview span {
  line-height: 1.45;
}

.game-shell {
  grid-template-columns: 236px minmax(0, 1fr);
  border-radius: 18px;
}

.game-menu,
.game-stage,
.tool-card,
.community-card,
.info-panel {
  min-width: 0;
}

.board-frame canvas {
  max-width: 100%;
}

#gomoku-board {
  aspect-ratio: 1;
}

.stealth-cover {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #f7f7f4;
}

.stealth-document {
  width: min(760px, 100%);
  min-height: min(540px, calc(100svh - 36px));
  padding: 28px;
  border: 1px solid #d8d8d2;
  border-radius: 8px;
  background: #fff;
  color: #2d3432;
  box-shadow: 0 14px 38px rgba(30, 38, 35, 0.1);
}

.document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 30px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e3e3dc;
  color: #66706c;
  font-size: 13px;
}

.document-toolbar button {
  padding: 8px 12px;
  border: 1px solid #d8d8d2;
  border-radius: 6px;
  background: #f7f7f4;
  color: #39433f;
  font-weight: 800;
}

body.stealth-mode {
  background: #f7f7f4;
}

body.stealth-mode .section-head,
body.stealth-mode .toolbox-head,
body.stealth-mode .community-head {
  border-color: #d8d8d2;
  background: #fff;
  color: #2d3432;
  box-shadow: 0 8px 24px rgba(30, 38, 35, 0.08);
}

body.stealth-mode .section-copy,
body.stealth-mode .fish-actions span,
body.stealth-mode .connection-box label,
body.stealth-mode .room-help {
  color: #66706c;
}

body.stealth-mode .section-kicker,
body.stealth-mode .panel-label,
body.stealth-mode .connection-status {
  color: #4f625d;
}

body.stealth-mode .feature-strip,
body.stealth-mode .game-overview {
  display: none;
}

body.stealth-mode .fish-actions button,
body.stealth-mode .connection-box,
body.stealth-mode .stealth-panel {
  border-color: #d8d8d2;
  background: #f7f7f4;
  color: #2d3432;
  box-shadow: none;
}

body.stealth-mode .stealth-panel strong {
  color: #2d3432;
}

body.stealth-mode .module-bar {
  background: #343c39;
}

body.stealth-mode .mode-chip {
  border-color: #cfd6d2;
  background: #eef2ef;
  color: #33403c;
}

body.popout-page .section-head {
  min-height: auto;
}

body.popout-page .fish-actions,
body.popout-page .stealth-panel {
  display: none;
}

@media (max-width: 980px) {
  .module-bar {
    grid-template-columns: 1fr;
  }

  .module-nav,
  .stealth-nav {
    justify-content: flex-start;
  }

  .section-head {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .fish-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .connection-row {
    grid-template-columns: 1fr 1fr;
  }

  .connection-row .primary {
    grid-column: 1 / -1;
  }

  .game-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-shell {
    grid-template-columns: 1fr;
  }

  .game-menu {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .game-tab {
    flex: 0 0 126px;
  }
}

@media (max-width: 620px) {
  .site-header,
  .game-section,
  .toolbox-section,
  .community-section {
    width: min(100vw - 10px, 760px);
  }

  .site-header {
    padding-top: 6px;
  }

  .module-bar {
    gap: 8px;
    padding: 8px;
  }

  .module-brand,
  .module-current,
  .module-nav a,
  .module-nav span,
  .stealth-nav button,
  .mode-chip {
    min-height: 30px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .module-nav,
  .stealth-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
  }

  .section-head,
  .toolbox-head,
  .community-head {
    padding: 12px;
    border-radius: 14px;
  }

  .fish-console h1 {
    font-size: 31px;
    line-height: 1.1;
  }

  .fish-console .section-copy {
    font-size: 14px;
    line-height: 1.65;
  }

  .fish-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .fish-actions button {
    min-height: 76px;
    padding: 10px;
  }

  .fish-actions strong {
    font-size: 15px;
  }

  .feature-strip {
    gap: 6px;
  }

  .feature-strip span {
    min-height: 28px;
    padding: 6px 8px;
  }

  .connection-row {
    grid-template-columns: 1fr;
  }

  .room-actions,
  .stealth-actions {
    grid-template-columns: 1fr;
  }

  .bot-toggle {
    grid-column: auto;
  }

  .game-overview {
    grid-template-columns: 1fr;
  }

  .game-overview div {
    min-height: 68px;
    padding: 12px;
  }

  .game-stage {
    padding: 10px;
  }

  .game-menu {
    padding: 8px;
  }

  .game-tab {
    flex: 0 0 98px;
    grid-template-columns: 1fr;
    place-items: center;
    text-align: center;
  }

  .game-tab small {
    display: none;
  }

  .panel-head {
    align-items: flex-start;
    min-height: 0;
  }

  .panel-head h2 {
    font-size: 22px;
  }

  .status-pill {
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tool-grid,
  .community-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .novel-layout {
    grid-template-columns: 1fr;
  }

  .novel-shelf {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .novel-book-card {
    flex: 0 0 180px;
    scroll-snap-align: start;
  }

  .novel-url-row,
  .chat-input-row {
    grid-template-columns: 1fr;
  }

  .novel-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .novel-shelf-actions,
  .novel-current-actions {
    width: 100%;
  }

  .novel-shelf-actions button,
  .novel-current-actions button {
    flex: 1 1 140px;
  }

  .stealth-document {
    min-height: calc(100svh - 24px);
    padding: 18px;
  }
}

@media (max-width: 390px) {
  .panel-head {
    display: grid;
  }

  .status-pill {
    max-width: 100%;
    justify-self: start;
  }
}

.game-section.compact-mode .connection-row {
  grid-template-columns: 1fr;
}

.game-section.compact-mode .room-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 460px) {
  .game-section.compact-mode .room-actions {
    grid-template-columns: 1fr;
  }
}

