/* PC side panel: chat / menu / online users (1024px+) */

#pc-side-panel {
  display: none;
}

#pc-side-panel-toggle {
  display: none;
}

@media (min-width: 1024px) {
  :root {
    --pc-side-panel-width: 320px;
  }

  #pc-side-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--pc-side-panel-width);
    background: rgba(14, 16, 24, 0.98);
    border-right: 1px solid rgba(42, 48, 70, 0.8);
    z-index: 55;
    transition: transform 0.25s ease;
  }

  #pc-side-panel.pc-collapsed {
    transform: translateX(-100%);
  }

  #pc-side-panel.pc-open {
    transform: translateX(0);
  }

  #pc-side-panel-toggle {
    display: flex;
    position: fixed;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 56;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 208, 107, 0.2);
    border: 1px solid rgba(255, 208, 107, 0.4);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  #pc-side-panel-toggle:hover {
    background: rgba(255, 208, 107, 0.3);
  }

  #pc-side-panel-toggle:active {
    transform: translateY(-50%) scale(0.95);
  }

  #pc-side-panel-toggle.hidden {
    display: none !important;
  }

  .pc-side-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  .pc-side-panel-header {
    display: flex;
    border-bottom: 1px solid rgba(42, 48, 70, 0.8);
    padding: 8px;
    gap: 4px;
    flex-shrink: 0;
  }

  .pc-side-panel-header button {
    flex: 1;
    padding: 7px 4px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    background: rgba(24, 28, 40, 0.8);
    color: rgba(148, 163, 184, 0.9);
    border: 1px solid rgba(42, 48, 70, 0.8);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }

  .pc-side-panel-header button:hover {
    background: rgba(32, 37, 58, 0.9);
  }

  .pc-side-panel-header button.active {
    background: rgba(255, 208, 107, 0.2);
    color: #ffd06b;
    border-color: rgba(255, 208, 107, 0.4);
  }

  .pc-side-panel-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
  }

  .pc-tab-content {
    position: absolute !important;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .pc-tab-content.hidden {
    display: none;
  }

  /* Chat tab: host the existing mobile chat panel */
  #pc-panel-chat-content {
    position: relative;
  }

  #pc-panel-chat-content > #chat-panel,
  #pc-panel-chat-content > #explore-chat-panel {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    min-height: auto !important;
    bottom: auto !important;
    right: auto !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    display: flex !important;
  }

  #pc-panel-chat-content > #chat-panel.hidden,
  #pc-panel-chat-content > #explore-chat-panel.hidden {
    display: flex !important;
  }

  #pc-panel-chat-content > #chat-panel #chat-close,
  #pc-panel-chat-content > #explore-chat-panel #explore-chat-close {
    display: none !important;
  }

  /* Hide mobile chat FAB/preview on PC */
  #fab-menu,
  #global-fab-menu,
  #chat-preview,
  #chat-input-bar {
    display: none !important;
  }

  /* Hide source chat panel when it is not inside the side panel (should not happen on PC) */
  body:not(.pc-chat-in-panel) #chat-panel,
  body:not(.pc-chat-in-panel) #explore-chat-panel {
    display: none !important;
  }

  /* Panel chat message list (LINE-like) */
  body.pc-chat-in-panel #chat-history,
  body.pc-chat-in-panel #explore-global-messages,
  body.pc-chat-in-panel #chat-group-messages,
  body.pc-chat-in-panel #chat-dm-messages,
  body.pc-chat-in-panel #explore-group-messages,
  body.pc-chat-in-panel #explore-dm-messages {
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  body.pc-chat-in-panel #chat-history > *,
  body.pc-chat-in-panel #explore-global-messages > *,
  body.pc-chat-in-panel #chat-group-messages > *,
  body.pc-chat-in-panel #chat-dm-messages > *,
  body.pc-chat-in-panel #explore-group-messages > *,
  body.pc-chat-in-panel #explore-dm-messages > * {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .pc-chat-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
  }

  .pc-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 208, 107, 0.15);
    border: 1px solid rgba(255, 208, 107, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
  }

  .pc-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
  }

  .pc-chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .pc-chat-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
  }

  .pc-chat-name {
    font-size: 11px;
    font-weight: bold;
    color: rgba(255, 208, 107, 0.95);
    text-decoration: underline;
    text-decoration-color: rgba(255, 208, 107, 0.3);
  }

  .pc-chat-name-me {
    color: #38bdf8;
  }

  .pc-chat-time {
    font-size: 10px;
    color: rgba(100, 116, 139, 0.9);
    flex-shrink: 0;
  }

  .pc-chat-body {
    font-size: 12px;
    line-height: 1.45;
    color: rgba(226, 232, 240, 0.95);
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }
  /* Side-panel-only chat sub-tabs: question / guild / icon */
  body.pc-chat-in-panel .pc-chat-subtab {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
  }

  body.pc-chat-in-panel .pc-chat-subtab.hidden {
    display: none !important;
  }

  body.pc-chat-in-panel .pc-chat-subtab-right {
    margin-left: auto;
  }

  /* チャットサブタブ一覧を横幅いっぱいにし、⚙だけ右端へ */
  body.pc-chat-in-panel #home-chat-tabs,
  body.pc-chat-in-panel #explore-chat-tabs {
    width: 100%;
  }

  body:not(.pc-chat-in-panel) .pc-chat-subtab {
    display: none !important;
  }

  /* Guild placeholder body (only when visible) */
  #chat-guild-body:not(.hidden),
  #explore-guild-body:not(.hidden) {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    color: rgba(148, 163, 184, 0.9);
    font-size: 12px;
  }

  /* Question bodies should stretch like global */
  #chat-question-body:not(.hidden),
  #explore-question-body:not(.hidden) {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
  }

  /* Prevent wheel events inside panel from scrolling the main page */
  .pc-side-panel-body,
  #chat-history,
  #chat-question-history,
  #explore-global-messages,
  #explore-question-messages,
  #chat-group-messages,
  #chat-dm-messages,
  #chat-dm-list,
  #chat-group-list,
  #explore-group-messages,
  #explore-dm-messages,
  #explore-group-list,
  #explore-dm-list,
  #pc-online-list {
    overscroll-behavior: contain;
  }

  /* Panel position: right */
  #pc-side-panel.pc-panel-right {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid rgba(42, 48, 70, 0.8);
  }

  #pc-side-panel-toggle.pc-panel-right {
    left: auto;
    right: 12px;
  }

  body.pc-panel-right.pc-side-panel-visible #bottom-nav {
    left: 0;
    right: var(--pc-side-panel-width);
  }

  body.pc-panel-right.pc-side-panel-visible {
    padding-left: 0;
    padding-right: var(--pc-side-panel-width);
  }

  /* Online guild filter */
  .pc-online-filter-btn {
    flex: 1;
    padding: 5px 4px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    background: rgba(24, 28, 40, 0.8);
    color: rgba(148, 163, 184, 0.9);
    border: 1px solid rgba(42, 48, 70, 0.8);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }

  .pc-online-filter-btn:hover {
    background: rgba(32, 37, 58, 0.9);
  }

  .pc-online-filter-btn.active {
    background: rgba(255, 208, 107, 0.2);
    color: #ffd06b;
    border-color: rgba(255, 208, 107, 0.4);
  }
}

/* Chat sub-tab unread badge (shared PC / mobile) */
.pc-chat-subtab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 9999px;
  background: #f43f5e;
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  line-height: 1;
}

.pc-chat-subtab-badge.hidden {
  display: none !important;
}

/* Chat row styles: shared between PC side panel and mobile panel */
.pc-chat-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pc-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 208, 107, 0.15);
  border: 1px solid rgba(255, 208, 107, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}

.pc-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.pc-chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pc-chat-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.pc-chat-name {
  font-size: 11px;
  font-weight: bold;
  color: rgba(255, 208, 107, 0.95);
  text-decoration: underline;
  text-decoration-color: rgba(255, 208, 107, 0.3);
}

.pc-chat-name-me {
  color: #38bdf8;
}

.pc-chat-time {
  font-size: 10px;
  color: rgba(100, 116, 139, 0.9);
  flex-shrink: 0;
}

.pc-chat-body {
  font-size: 12px;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.95);
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (min-width: 1440px) {
  :root {
    --pc-side-panel-width: 360px;
  }

  body.pc-side-panel-visible #bottom-nav {
    left: var(--pc-side-panel-width);
  }

  #pc-side-panel {
    transform: translateX(0) !important;
  }

  #pc-side-panel-toggle {
    display: none !important;
  }

  body.pc-side-panel-visible {
    padding-left: var(--pc-side-panel-width);
  }
}

@media (min-width: 1920px) {
  :root {
    --pc-side-panel-width: 420px;
  }
}

/* Online tab specific styles */
#pc-online-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.5) transparent;
}

#pc-online-list::-webkit-scrollbar {
  width: 4px;
}

#pc-online-list::-webkit-scrollbar-track {
  background: transparent;
}

#pc-online-list::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.5);
  border-radius: 2px;
}

.pc-online-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(24, 28, 40, 0.6);
  border: 1px solid rgba(42, 48, 70, 0.6);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pc-online-item:hover {
  background: rgba(32, 37, 58, 0.8);
  border-color: rgba(71, 85, 105, 0.8);
}

.pc-online-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 208, 107, 0.15);
  border: 1px solid rgba(255, 208, 107, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.pc-online-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.pc-online-info {
  flex: 1;
  min-width: 0;
}

.pc-online-name {
  font-size: 12px;
  font-weight: bold;
  color: rgba(226, 232, 240, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-online-meta {
  font-size: 10px;
  color: rgba(148, 163, 184, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-online-empty {
  text-align: center;
  color: rgba(148, 163, 184, 0.7);
  font-size: 12px;
  padding: 24px 8px;
}

/* Menu tab buttons */
.pc-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  align-content: start;
}

.pc-menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 12px;
  background: rgba(24, 28, 40, 0.8);
  border: 1px solid rgba(42, 48, 70, 0.8);
  color: rgba(226, 232, 240, 0.95);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.pc-menu-btn:hover {
  background: rgba(32, 37, 58, 0.95);
  border-color: rgba(71, 85, 105, 0.9);
}

.pc-menu-btn:active {
  transform: scale(0.98);
}

.pc-menu-btn:disabled,
.pc-menu-btn.pc-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pc-menu-btn .pc-menu-icon {
  font-size: 22px;
  line-height: 1;
}

.pc-menu-btn .pc-menu-label {
  font-size: 11px;
  font-weight: bold;
}

.pc-menu-btn .pc-menu-badge {
  font-size: 9px;
  color: rgba(148, 163, 184, 0.7);
}

/* Online status icon picker modal */
.pc-online-icon-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pc-online-icon-modal.hidden {
  display: none;
}

.pc-online-icon-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.pc-online-icon-modal-content {
  position: relative;
  width: min(560px, calc(100vw - 48px));
  max-height: min(640px, calc(100vh - 48px));
  background: rgba(14, 16, 24, 0.98);
  border: 1px solid rgba(42, 48, 70, 0.9);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.pc-online-icon-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(42, 48, 70, 0.8);
  flex-shrink: 0;
}

.pc-online-icon-modal-title {
  font-size: 14px;
  font-weight: bold;
  color: rgba(226, 232, 240, 0.95);
  margin: 0;
}

.pc-online-icon-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(24, 28, 40, 0.8);
  border: 1px solid rgba(42, 48, 70, 0.8);
  color: rgba(148, 163, 184, 0.9);
  font-size: 20px;
  cursor: pointer;
}

.pc-online-icon-modal-close:hover {
  background: rgba(32, 37, 58, 0.9);
}

.pc-online-icon-grid {
  flex: 1;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  padding: 12px;
}

.pc-online-icon-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(24, 28, 40, 0.8);
  border: 1px solid rgba(42, 48, 70, 0.8);
  color: rgba(226, 232, 240, 0.9);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.pc-online-icon-choice:hover {
  background: rgba(32, 37, 58, 0.95);
  border-color: rgba(71, 85, 105, 0.9);
}

.pc-online-icon-choice:active {
  transform: scale(0.97);
}

.pc-online-icon-choice img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
}

.pc-online-icon-choice span {
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pc-online-icon-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(148, 163, 184, 0.7);
  font-size: 12px;
  padding: 32px 8px;
}

/* Chat settings modal */
.pc-chat-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pc-chat-settings-modal.hidden {
  display: none;
}

.pc-chat-settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.pc-chat-settings-modal-content {
  position: relative;
  width: min(480px, calc(100vw - 48px));
  max-height: min(720px, calc(100vh - 48px));
  background: rgba(14, 16, 24, 0.98);
  border: 1px solid rgba(42, 48, 70, 0.9);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.pc-chat-settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(42, 48, 70, 0.8);
  flex-shrink: 0;
}

.pc-chat-settings-modal-title {
  font-size: 14px;
  font-weight: bold;
  color: rgba(226, 232, 240, 0.95);
  margin: 0;
}

.pc-chat-settings-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(24, 28, 40, 0.8);
  border: 1px solid rgba(42, 48, 70, 0.8);
  color: rgba(148, 163, 184, 0.9);
  font-size: 20px;
  cursor: pointer;
}

.pc-chat-settings-modal-close:hover {
  background: rgba(32, 37, 58, 0.9);
}

.pc-chat-settings-body {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pc-settings-section {
  background: rgba(24, 28, 40, 0.5);
  border: 1px solid rgba(42, 48, 70, 0.7);
  border-radius: 12px;
  padding: 12px;
}

.pc-settings-section-title {
  font-size: 12px;
  font-weight: bold;
  color: rgba(255, 208, 107, 0.9);
  margin-bottom: 10px;
}

.pc-settings-current-icon {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.pc-settings-icon-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 208, 107, 0.15);
  border: 1px solid rgba(255, 208, 107, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pc-settings-icon-preview img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
}

.pc-settings-icon-name {
  font-size: 12px;
  font-weight: bold;
  color: rgba(226, 232, 240, 0.95);
}

.pc-settings-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.pc-settings-icon-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(24, 28, 40, 0.8);
  border: 1px solid rgba(42, 48, 70, 0.8);
  color: rgba(226, 232, 240, 0.9);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.pc-settings-icon-choice:hover {
  background: rgba(32, 37, 58, 0.95);
  border-color: rgba(71, 85, 105, 0.9);
}

.pc-settings-icon-choice.selected {
  background: rgba(255, 208, 107, 0.2);
  border-color: rgba(255, 208, 107, 0.6);
  color: #ffd06b;
}

.pc-settings-icon-choice:active {
  transform: scale(0.97);
}

.pc-settings-icon-choice img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
}

.pc-settings-icon-choice span {
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pc-settings-icon-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(148, 163, 184, 0.7);
  font-size: 12px;
  padding: 24px 8px;
}

.pc-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(42, 48, 70, 0.5);
}

.pc-settings-row:last-child {
  border-bottom: none;
}

.pc-settings-label {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.9);
}

.pc-settings-segment {
  display: flex;
  gap: 4px;
}

.pc-settings-segment button {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: bold;
  background: rgba(24, 28, 40, 0.8);
  color: rgba(148, 163, 184, 0.9);
  border: 1px solid rgba(42, 48, 70, 0.8);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pc-settings-segment button:hover {
  background: rgba(32, 37, 58, 0.95);
}

.pc-settings-segment button.active {
  background: rgba(255, 208, 107, 0.2);
  color: #ffd06b;
  border-color: rgba(255, 208, 107, 0.4);
}

.pc-settings-segment button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pc-settings-segment-wrap {
  flex-wrap: wrap;
}

.pc-settings-row-vertical {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.pc-settings-row-vertical .pc-settings-segment {
  width: 100%;
}

.pc-settings-row-vertical .pc-settings-group-select {
  padding-top: 0;
}

/* グループセレクト */
.pc-settings-group-select {
  width: 100%;
  padding-top: 6px;
}

.pc-settings-select {
  width: 100%;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(24, 28, 40, 0.8);
  color: rgba(226, 232, 240, 0.9);
  border: 1px solid rgba(42, 48, 70, 0.8);
  cursor: pointer;
}

/* ショートカットボタン */
.pc-settings-shortcut-row {
  display: flex;
  gap: 8px;
  padding: 8px 0;
}

.pc-settings-shortcut-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: bold;
  background: rgba(24, 28, 40, 0.8);
  color: rgba(226, 232, 240, 0.9);
  border: 1px solid rgba(42, 48, 70, 0.8);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pc-settings-shortcut-btn:hover {
  background: rgba(32, 37, 58, 0.95);
  border-color: rgba(255, 208, 107, 0.4);
}

.pc-settings-shortcut-icon {
  font-size: 18px;
}

/* ランキングモーダル */
.pc-ranking-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pc-ranking-modal.hidden {
  display: none;
}

.pc-ranking-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.pc-ranking-modal-content {
  position: relative;
  width: min(520px, calc(100vw - 48px));
  max-height: min(720px, calc(100vh - 48px));
  background: rgba(14, 16, 24, 0.98);
  border: 1px solid rgba(42, 48, 70, 0.9);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.pc-ranking-body {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pc-ranking-job-tabs,
.pc-ranking-sub-tabs,
.pc-ranking-subjob-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pc-ranking-sub-tabs {
  border-bottom: 1px solid rgba(42, 48, 70, 0.5);
  padding-bottom: 8px;
}

.pc-ranking-job-tabs button,
.pc-ranking-sub-tabs button,
.pc-ranking-subjob-tabs button {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: bold;
  background: rgba(24, 28, 40, 0.8);
  color: rgba(148, 163, 184, 0.9);
  border: 1px solid rgba(42, 48, 70, 0.8);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pc-ranking-job-tabs button.active,
.pc-ranking-sub-tabs button.active,
.pc-ranking-subjob-tabs button.active {
  background: rgba(255, 208, 107, 0.2);
  color: #ffd06b;
  border-color: rgba(255, 208, 107, 0.4);
}

.pc-ranking-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pc-ranking-job-title {
  font-size: 12px;
  font-weight: bold;
  color: rgba(255, 208, 107, 0.9);
  text-align: center;
  padding: 4px 0;
}

.pc-ranking-loading {
  text-align: center;
  color: rgba(148, 163, 184, 0.7);
  font-size: 12px;
  padding: 24px 8px;
}

.pc-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pc-ranking-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(24, 28, 40, 0.6);
  border: 1px solid rgba(42, 48, 70, 0.6);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pc-ranking-row:hover {
  background: rgba(32, 37, 58, 0.8);
  border-color: rgba(71, 85, 105, 0.8);
}

.pc-ranking-medal {
  font-size: 20px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.pc-ranking-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 208, 107, 0.15);
  border: 1px solid rgba(255, 208, 107, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}

.pc-ranking-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

/* モバイルパネル */
.pc-mobile-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: rgba(14, 16, 24, 0.98);
  color: rgba(226, 232, 240, 0.95);
}

.pc-mobile-panel.hidden {
  display: none;
}

.pc-mobile-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(42, 48, 70, 0.9);
  background: rgba(14, 16, 24, 0.95);
}

.pc-mobile-panel-title {
  font-size: 16px;
  font-weight: bold;
  margin: 0;
}

.pc-mobile-panel-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(71, 85, 105, 0.5);
  background: rgba(24, 28, 40, 0.8);
  color: rgba(226, 232, 240, 0.9);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.pc-mobile-panel-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.pc-mobile-panel-body > .pc-tab-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pc-mobile-panel-body > .pc-tab-content.hidden {
  display: none;
}

.pc-mobile-tab-bar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(42, 48, 70, 0.9);
  background: rgba(14, 16, 24, 0.95);
}

.pc-mobile-tab-bar .pc-panel-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  background: transparent;
  border: none;
  color: rgba(148, 163, 184, 0.8);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.pc-mobile-tab-bar .pc-panel-tab.active {
  color: #ffd06b;
}

.pc-mobile-tab-icon {
  font-size: 18px;
  line-height: 1;
}

.pc-mobile-tab-label {
  font-size: 10px;
}

/* モバイルパネル内の旧チャットソース表示調整 */
#pc-panel-chat-content > #chat-panel,
#pc-panel-chat-content > #explore-chat-panel {
  display: flex !important;
  flex-direction: column;
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* モバイルパネル内では旧ヘッダーの「閉じる」ボタンを非表示（モバイルヘッダーで代替） */
#pc-panel-chat-content #chat-close,
#pc-panel-chat-content #explore-chat-close {
  display: none;
}
/* PC ではモバイルパネルを常に非表示 */
@media (min-width: 1024px) {
  .pc-mobile-panel {
    display: none !important;
  }
}

/* モバイルでは PC サイドパネルトグルと PC パネルを非表示に */
@media (max-width: 1023px) {
  #pc-side-panel,
  #pc-side-panel-toggle {
    display: none !important;
  }

  /* 既存 FAB の展開メニューは不要（メイン FAB が直接チャットを開く） */
  #fab-board,
  #chat-toggle,
  #global-fab-board,
  #global-fab-chat {
    display: none !important;
  }
}

.pc-ranking-info {
  flex: 1;
  min-width: 0;
}

.pc-ranking-name {
  font-size: 13px;
  font-weight: bold;
  color: rgba(226, 232, 240, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-ranking-meta {
  font-size: 11px;
  color: rgba(148, 163, 184, 0.8);
}

/* iframe モーダル */
.pc-iframe-modal-content {
  position: relative;
  background: #1a1e2e;
  border: 1px solid rgba(42, 48, 70, 0.8);
  border-radius: 12px;
  max-width: 600px;
  width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pc-iframe-modal-frame {
  flex: 1;
  width: 100%;
  min-height: 400px;
  max-height: 70vh;
  border: none;
  background: #0d1017;
}
