/* =========================================================
   RESET / BASE
   ========================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  background: #f5f6f8;
  color: #333;
}

/* HEADER（ホーム・ルーム共通） */
.header,
.room-header-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e3e3e3;
}

/* 三本線ボタン：位置を固定して3本必ず見えるように */
.menu-btn {
  border: 1px solid #d0d0d0;
  background: #ffffff;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  position: relative;
  cursor: pointer;
}

/* 3本ライン */
.menu-btn span {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 3px;
  background: #222;
  border-radius: 2px;
}

/* 上・中・下の位置 */
.menu-btn span:nth-child(1) { top: 9px; }
.menu-btn span:nth-child(2) { top: 16px; }
.menu-btn span:nth-child(3) { top: 23px; }

/* 戻るボタン（←） */
.back-btn {
  border: 1px solid #d0d0d0;
  background: #ffffff;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}


/* ロゴ部分 */
.header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 18px;
}
.crown {
  font-size: 18px;
}
.header-title {
  letter-spacing: 0.03em;
}
.header-tagline {
  font-size: 11px;
  color: #777;
}

/* ルーム名バー */
.room-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.room-header-name {
  font-weight: 700;
  font-size: 16px;
}
.room-header-desc {
  font-size: 11px;
  color: #777;
}

/* =========================================================
   DRAWER（サイドメニュー）
   ========================================================= */
.drawer {
  position: fixed;
  left: -260px;
  top: 0;
  width: 260px;
  height: 100%;
  background: #ffffff;
  border-right: 1px solid #e0e0e0;
  transition: left 0.25s ease;
  z-index: 30;
}
.drawer.open {
  left: 0;
}

.drawer-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 25;
}
.drawer-bg.show {
  opacity: 1;
  pointer-events: auto;
}

.drawer-inner {
  padding: 18px 18px 24px;
}
.drawer-close {
  float: right;
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}
.drawer-title {
  margin-top: 8px;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 600;
}
.drawer-list {
  list-style: none;
}
.drawer-list li {
  margin: 8px 0;
}
.drawer-list a {
  text-decoration: none;
  color: #333;
  font-size: 14px;
}
.drawer-list a:hover {
  text-decoration: underline;
}

/* =========================================================
   HOME（扉一覧ページ）
   ========================================================= */
.main {
  padding: 16px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.door-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.door-card {
  text-decoration: none;
  color: inherit;
  text-align: center;
}

/* 扉の外枠 */
.door {
  position: relative;
  width: 100%;
  padding-top: 130%;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #dddddd;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  overflow: hidden;
}

/* 内側の木の扉 */
.door-panel {
  position: absolute;
  inset: 10% 16% 10% 16%;
  background: linear-gradient(180deg, #f7e3c6, #f2d1a3);
  border-radius: 8px 8px 4px 4px;
  box-shadow: inset 0 0 0 2px rgba(184, 141, 83, 0.6);
}

/* 取っ手 */
.door-handle {
  position: absolute;
  right: 20%;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #b8893f;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #e9c88f;
}

/* 扉の名前 */
.door-name {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
}

/* KING表示 */
.king-label {
  font-size: 11px;
  color: #c08900;
  margin-top: 2px;
}

/* =========================================================
   room.html（掲示板ページ）
   ========================================================= */
.room-main {
  padding: 14px 16px 24px;
}

/* KING ボックス */
.room-king-box {
  padding: 10px 12px;
  margin-bottom: 14px;
  background: #fff7db;
  border-radius: 8px;
  border: 1px solid #f5d589;
}

.room-king-label {
  font-size: 13px;
  font-weight: 600;
  color: #9a7200;
}
.king-icon {
  margin-left: 3px;
}
.room-king-note {
  font-size: 11px;
  color: #8b6c10;
  margin-top: 2px;
}

.room-king-post {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fffdf5;
  border: 1px dashed #f0c96c;
}
.room-king-post-placeholder {
  font-size: 11px;
  color: #b08b33;
}

/* 投稿フォーム */
.post-section {
  margin-bottom: 18px;
}

.post-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.post-form {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e1e1e1;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-label {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.post-input,
.post-textarea,
.post-file {
  font-family: inherit;
  font-size: 13px;
}

.post-input,
.post-textarea {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d6d6d6;
}

.post-textarea {
  resize: vertical;
}

.post-submit-btn {
  margin-top: 4px;
  padding: 6px 0;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.post-submit-btn:hover {
  opacity: 0.95;
}

.post-note {
  margin-top: 4px;
  font-size: 11px;
  color: #777;
}

/* タイムライン */
.timeline-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

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

.timeline-empty {
  font-size: 12px;
  color: #888;
}

/* 投稿カード */
.post-card {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e1e1e1;
  padding: 8px 10px 10px;
}

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

.post-card-name {
  font-size: 13px;
  font-weight: 600;
}

.post-card-time {
  font-size: 11px;
  color: #999;
}

.post-card-text {
  margin-top: 4px;
  font-size: 13px;
  white-space: pre-wrap;
}

.post-card-image {
  margin-top: 6px;
  max-width: 100%;
  border-radius: 6px;
}

.post-card-actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
}

.post-card-actions button {
  border: 1px solid #d4d4d4;
  background: #f8f8f8;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}

/* =========================================================
   PC対応（中央寄せ）
   ========================================================= */
@media (min-width: 640px) {
  .main,
  .room-main {
    max-width: 720px;
    margin: 0 auto;
  }
}
/* ==== 今週のランキング ==== */
.room-ranking-box{
  margin: 0 0 1.4rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}
.room-ranking-title{
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.room-ranking-list{
  list-style: none;
  margin: 0;
  padding: 0;
}
.room-ranking-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.8rem;
}
.room-ranking-rank{
  font-weight: 700;
  color: #6b7280;
  min-width: 2.2rem;
}
.room-ranking-name{
  flex: 1;
  font-weight: 600;
}
.room-ranking-point{
  font-size: 0.75rem;
  color: #4b5563;
}
.room-ranking-empty{
  font-size: 0.8rem;
  color: #6b7280;
}
.post-card.highlight-strong {
  animation: highlightFlash 1.6s ease-out;
  box-shadow: 0 0 12px rgba(255, 200, 0, 0.7);
}

@keyframes highlightFlash {
  0%   { background-color: #fff7c0; }
  50%  { background-color: #ffe98a; }
  100% { background-color: white; }
}
.post-card.highlight-strong {
  animation: highlightFlash 1.6s ease-out;
  box-shadow: 0 0 12px rgba(255, 200, 0, 0.7);
}

@keyframes highlightFlash {
  0%   { background-color: #fff7c0; }
  50%  { background-color: #ffe98a; }
  100% { background-color: white; }
}
/* ランキングカードの見た目 */
.ranking-list {
  margin-top: 4px;
}

.ranking-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f9fafb;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.ranking-item:hover,
.ranking-item:focus-visible {
  background: #eef2ff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.ranking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.ranking-no {
  font-weight: 700;
}

.ranking-name {
  flex: 1;
}

.ranking-likes {
  white-space: nowrap;
  font-size: 0.85rem;
  opacity: 0.8;
}

.ranking-text {
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.ranking-time {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ランキングからジャンプした投稿を光らせる */
.post-card.highlight {
  box-shadow:
    0 0 0 2px #facc15,
    0 0 18px rgba(250, 204, 21, 0.85);
  animation: kr-highlight-flash 0.8s ease-out;
}

@keyframes kr-highlight-flash {
  0%   { transform: scale(1.01); }
  100% { transform: scale(1); }
}
.sub-header {
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  text-align: center;
}

.sub-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.back-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.9rem;
  color: #555;
  text-decoration: none;
}

.sub-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px;
}

.section {
  margin-bottom: 28px;
}

.section-title {
  font-size: 1.2rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.steps li,
.point-rules li {
  margin: 6px 0;
  line-height: 1.6;
}

.note {
  font-size: 0.85rem;
  color: #666;
}

.copy-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: #2d89ef;
  color: #fff;
  font-size: 0.9rem;
}