/* -------------------------------------------------
   Easy Running BBS Modern Style with Dark Mode
   Ver.2025-11-07 (Organized)
   ------------------------------------------------- */

/* ========== CSS Variables ========== */
:root {
  /* Light Mode Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-gradient-start: #ffffff;
  --bg-gradient-end: #f0f4f8;
  --text-primary: #1a202c;
  --text-secondary: #2d3748;
  --text-muted: #718096;
  --accent-primary: #5b8fd8;
  --accent-secondary: #4a7fc0;
  --accent-hover: #3d6ba8;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --input-border: #cbd5e0;
  --button-primary: #5b8fd8;
  --button-primary-hover: #4a7fc0;
  --button-secondary: #f7fafc;
  --button-secondary-hover: #edf2f7;
  --quote-bg: #f7fafc;
  /* Error colors (Light mode) */
  --err-bg: #fff3cd;
  --err-border: #ffc107;
  --err-text: #1a202c;
}

/* Dark Mode Colors - System preference & Manual toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-gradient-start: #1a202c;
    --bg-gradient-end: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --accent-primary: #6fa3e8;
    --accent-secondary: #5b8fd8;
    --accent-hover: #8bb9f0;
    --border-color: #4a5568;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --card-bg: #2d3748;
    --input-bg: #374151;
    --input-border: #4a5568;
    --button-primary: #5b8fd8;
    --button-primary-hover: #6fa3e8;
    --button-secondary: #374151;
    --button-secondary-hover: #4a5568;
    --quote-bg: #374151;
    /* Error colors (Dark mode) */
    --err-bg: #4a3b1f;
    --err-text: #ffffff;
  }
}

/* Manual Dark Mode Toggle */
[data-theme="dark"] {
  --bg-primary: #1a202c;
  --bg-secondary: #2d3748;
  --bg-gradient-start: #1a202c;
  --bg-gradient-end: #2d3748;
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #a0aec0;
  --accent-primary: #6fa3e8;
  --accent-secondary: #5b8fd8;
  --accent-hover: #8bb9f0;
  --border-color: #4a5568;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  --card-bg: #2d3748;
  --input-bg: #374151;
  --input-border: #4a5568;
  --button-primary: #5b8fd8;
  --button-primary-hover: #6fa3e8;
  --button-secondary: #374151;
  --button-secondary-hover: #4a5568;
  --quote-bg: #374151;
  /* Error colors (Dark mode) */
  --err-bg: #4a3b1f;
  --err-text: #ffffff;
}

/* ========== Base Styles ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  font-family: "Hiragino Maru Gothic W4 JIS2004", "游ゴシック体", "Yu Gothic", "Hiragino Sans", sans-serif;
  font-size: 1.0rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  line-height: 1.9;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== Header ========== */
#head {
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#head h1,
#head b {
  font-size: clamp(1.5rem, 5vw, 1.8rem);
  font-family: "Shin Go Medium", "Hiragino Sans", "游ゴシック体", "Yu Gothic", "メイリオ", sans-serif;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  margin: 0;
}

#head h1 .title-main,
#head h1 .title-dash,
#head h1 .title-sub {
  display: inline;
}

/* ========== Main Container ========== */
#main {
  max-width: 900px;
  margin: 2rem auto;
  background: var(--bg-primary);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  padding: 2rem 2rem 2.5rem;
  transition: box-shadow 0.3s ease;
}

#main:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ========== Navigation Buttons ========== */
.top-btn,
#back-btn {
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.button {
  display: inline-block;
  background: transparent;
  color: var(--accent-primary);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.6rem 1.25rem;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.button:hover {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--accent-hover);
}

.button.small {
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
}

.button.color.green {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.button.color.green:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.button.color.red {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.button.color.red:hover {
  background: #c82333;
  border-color: #bd2130;
}

/* ========== Hamburger Menu ========== */
.menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  right: 15px;
  width: 50px;
  height: 60px;
  cursor: pointer;
  z-index: 1100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  padding-bottom: 4px;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.menu-toggle:hover {
  box-shadow: var(--shadow-lg);
}

.menu-toggle::before {
  content: "MENU";
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.menu-toggle.active::before {
  content: "CLOSE";
  color: var(--accent-primary);
  font-weight: 700;
}

.menu-toggle span {
  display: block;
  width: 28px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.35s ease;
}

.menu-toggle span:not(:last-child) {
  margin-bottom: 5px;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ========== Article Card ========== */
.art {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.art:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* ========== Image Display ========== */
.img-box {
  margin: 1rem 0;
  text-align: left;
}

.img-box a {
  display: inline-block;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  text-decoration: none;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  line-height: 0;
  max-width: fit-content;
}

.img-box a:hover {
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
  border-color: var(--accent-primary);
}

.img-box .thumbnail {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: transform 0.3s ease;
}

.img-box a:hover .thumbnail {
  transform: scale(1.05);
}

/* ========== Search Results ========== */
.hit-msg {
  background: var(--bg-secondary);
  padding: 1rem 1.5rem;
  margin: 1rem 0;
  border-radius: 6px;
  font-size: 1rem;
  color: var(--text-secondary);
  text-align: center;
}

.hit-msg b {
  color: var(--accent-primary);
  font-size: 1.3rem;
  font-weight: 700;
}

.ta-c .art {
  text-align: left;
}

.ta-c .art > b:first-of-type {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.5rem;
}

.ta-c .art > b:not(:first-of-type) {
  font-weight: 400;
  color: var(--text-primary);
  margin-right: 1rem;
}

.ta-c .art p {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ========== Article Title ========== */
.ttl {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
  padding: 0 0 0.5rem 0;
  border-bottom: 2px solid var(--accent-primary);
  position: relative;
  transition: all 0.3s ease;
}

.ttl::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--accent-hover);
  transition: width 0.3s ease;
}

.art:hover .ttl::before {
  width: 60px;
}

/* ========== Comment ========== */
.com {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.8;
  text-align: left;
}

.com a {
  color: var(--accent-primary);
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.2s ease;
  word-break: break-all;
}

.com a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  background-color: rgba(91, 143, 216, 0.1);
}

.com .refcol {
  display: inline;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  margin: 0;
  font-style: italic;
  background: var(--quote-bg);
  border-left: 2px solid var(--accent-primary);
  border-radius: 3px;
  line-height: 1.5;
}

/* ========== Post Info ========== */
.info {
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

.info b {
  color: var(--text-primary);
  font-weight: normal;
  font-size: inherit;
  display: inline;
  margin-right: 1rem;
}

.info span {
  margin-left: 1rem;
  color: var(--text-muted);
}

.info span::before {
  content: "記事";
}

.info a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
  border-bottom: 1px solid transparent;
}

.info a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

/* ========== Post Form ========== */
#form,
#find,
#note {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  margin-top: 1.5rem;
}

#sub-ttl {
  font-size: 1.3rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-primary);
  position: relative;
}

#sub-ttl::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 80px;
  height: 2px;
  background: var(--accent-hover);
}

#find p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

#find label {
  display: inline-block;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* ========== Note Section ========== */
#note p {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-primary);
  position: relative;
}

#note p::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--accent-hover);
  transition: width 0.3s ease;
}

#note p:hover::before {
  width: 60px;
}

#note ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

#note ul li {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.8;
  list-style: none !important;
}

#note ul li::before {
  content: "▶";
  position: absolute;
  left: 0;
  color: var(--accent-primary);
  font-size: 0.75rem;
}

#note ul li b {
  color: var(--text-primary);
  font-weight: 600;
}

.close {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* ========== Table ========== */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.75rem;
}

th {
  text-align: left;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  vertical-align: top;
  border-radius: 6px 0 0 6px;
  width: 25%;
}

td {
  background: var(--input-bg);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0 6px 6px 0;
  border-left: none;
  font-size: 1rem;
}

/* ========== Form Inputs ========== */
input[type="text"],
input[type="password"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(91, 143, 216, 0.1);
  outline: none;
}

select {
  cursor: pointer;
  width: auto;
  min-width: 120px;
  margin: 0 0.5rem;
}

textarea {
  min-height: 8rem;
  field-sizing: content;
  resize: none;
  line-height: 1.6;
}

.wd-s { max-width: 150px; }
.wd-m { max-width: 300px; }
.wd-l { max-width: 500px; }
.wd-t { width: 100%; }

#find input[type="text"] {
  width: auto;
  min-width: 300px;
  margin-right: 0.5rem;
}

/* ========== File Upload ========== */
input[type="file"] {
  width: 100%;
  max-width: none;
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: all 0.2s ease;
  cursor: pointer;
}

input[type="file"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(91, 143, 216, 0.1);
  outline: none;
}

input[type="file"]::-webkit-file-upload-button {
  padding: 0.3rem 0.8rem;
  margin-right: 0.5rem;
  background: var(--button-secondary);
  color: var(--text-primary);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--button-secondary-hover);
  border-color: var(--accent-primary);
}

input[type="file"]::file-selector-button {
  padding: 0.3rem 0.8rem;
  margin-right: 0.5rem;
  background: var(--button-secondary);
  color: var(--text-primary);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

input[type="file"]::file-selector-button:hover {
  background: var(--button-secondary-hover);
  border-color: var(--accent-primary);
}

/* File upload description text */
input[type="file"] ~ br + span,
input[type="file"] + br + span {
  font-size: 1rem !important;
  color: var(--text-secondary) !important;
  display: inline-block;
  margin-top: 0.3rem;
}

td span[style*="font-size"] {
  font-size: inherit !important;
  color: var(--text-secondary) !important;
}

/* ========== Submit Button ========== */
input[type="submit"] {
  background: var(--button-primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

input[type="submit"]:hover {
  background: var(--button-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#form input[type="submit"] {
  display: block;
  margin: 0.75rem auto;
}

/* ========== Checkbox ========== */
input[type="checkbox"] {
  width: auto;
  margin: 0 0.3rem;
  cursor: pointer;
}

/* ========== CAPTCHA Image ========== */
.capt {
  vertical-align: middle;
  margin: 0 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* ========== Delete Form ========== */
#del-form {
  text-align: center;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.95rem;
  color: var(--text-secondary);
}

#del-form form {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 1rem;
  line-height: 2.5;
}

#del-form input[type="tel"],
#del-form input[type="password"] {
  width: 6rem;
  padding: 0.5rem;
  vertical-align: baseline;
}

#del-form input[type="submit"] {
  padding: 0.5rem 1.5rem;
  vertical-align: baseline;
}

/* ========== Center Alignment ========== */
.ta-c {
  text-align: center;
}

.ta-c .msg {
  margin-bottom: 2rem;
}

.ta-c .button {
  margin-top: 1rem;
}

/* ========== Error Message ========== */
.err {
  background: var(--err-bg);
  border: 2px solid var(--err-border);
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: left;
}

.err b {
  display: block;
  font-size: 1.5rem;
  color: #d32f2f;
  margin-bottom: 1rem;
  font-weight: 700;
  text-align: center;
}

.err p {
  color: var(--err-text);
  font-size: 1rem;
  line-height: 1.8;
}

/* ========== Past Log Pagination ========== */
.past-panel {
  margin: 2rem 0;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  text-align: center;
}

.past-panel a,
.past-panel span {
  display: inline-block;
  padding: 0.5rem 1rem;
  margin: 0.25rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--accent-primary);
  font-weight: 500;
  transition: all 0.2s ease;
}

.past-panel a:hover {
  background: var(--accent-primary);
  color: white;
}

.past-panel span {
  background: var(--accent-primary);
  color: white;
  font-weight: 700;
}

/* ========== Footer ========== */
p[style*="Verdana"] {
  text-align: center;
  font-size: 0.8rem !important;
  color: var(--text-muted);
  margin-top: 3rem;
}

p[style*="Verdana"] a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

p[style*="Verdana"] a:hover {
  color: var(--accent-hover);
}

/* ========== Form Field Description Text Consistency ========== */
td input[type="password"] ~ *,
td input[type="file"] ~ *,
td input[type="tel"] ~ * {
  font-size: 1rem;
  color: var(--text-secondary);
}

td *[style*="font-size:12px"],
td *[style*="font-size: 12px"] {
  font-size: 1rem !important;
}

/* ========== Responsive - PC (min-width: 769px) ========== */
@media screen and (min-width: 769px) {
  /* Hide <br> in td for password and captcha fields */
  td:has(input[type="password"]) br,
  td:has(input[type="tel"]) br {
    display: none;
  }

  /* Show br for file upload field */
  td:has(input[type="file"]) br {
    display: inline;
  }

  /* File upload description styling */
  td:has(input[type="file"]) span {
    display: block;
    margin-top: 0.3rem;
  }

  /* Alternative approach for browsers that don't support :has() */
  input[type="file"] + br {
    display: inline !important;
  }
  
  input[type="file"] + br + span {
    display: block !important;
    margin-top: 0.3rem;
  }
  
  input[type="password"] + br,
  input[type="tel"] + br {
    display: none !important;
  }

  /* td[colspan="2"] and th[colspan="2"]: th-like + Full Radius + Left Border */
  td[colspan="2"],
  th[colspan="2"] {
    background: var(--bg-secondary) !important;
    border-left: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
  }

  /* Normal td: No Left Border + Right Radius */
  td:not([colspan]) {
    border-left: none !important;
    border-radius: 0 6px 6px 0 !important;
  }

  /* Normal th: Left Radius */
  th:not([colspan]) {
    border-radius: 6px 0 0 6px !important;
  }

  /* File description text styling */
  td span[style*="font-size:12px"] {
    font-size: 1rem !important;
    color: var(--text-secondary) !important;
  }

  td input[type="file"] {
    width: 100%;
    max-width: none;
  }
}

/* ========== Responsive - Tablet & Mobile (max-width: 768px) ========== */
@media screen and (max-width: 768px) {
  /* Hamburger Menu Display */
  .menu-toggle {
    display: flex !important;
  }

  /* Header */
  #head {
    padding-top: 80px !important;
  }

  #head h1 {
    text-align: left !important;
    margin-left: 15px !important;
    padding-right: 70px !important;
  }

  #head h1 .title-main,
  #head h1 .title-sub {
    display: block;
    line-height: 1.4;
  }

  #head h1 .title-dash {
    display: none;
  }

  #head h1 .title-main {
    font-size: 1.2rem;
  }

  #head h1 .title-sub {
    font-size: 1.1rem;
    font-weight: 500;
  }

  #head b {
    text-align: left !important;
    margin-left: 15px !important;
    padding-right: 70px !important;
  }

  /* Navigation to Slide Menu */
  .top-btn {
    position: fixed !important;
    top: 0 !important;
    right: -280px !important;
    width: 280px !important;
    height: 100% !important;
    background: var(--bg-primary) !important;
    border-left: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-lg) !important;
    z-index: 1000 !important;
    margin: 0 !important;
    padding-top: 85px !important;
    overflow-y: auto !important;
    transition: right 0.3s ease !important;
    opacity: 0 !important;
    visibility: hidden !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 0 !important;
  }

  .top-btn.active {
    right: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .top-btn a {
    display: block !important;
    padding: 1.5rem 1.5rem !important;
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
    border-bottom: 1px solid var(--border-color) !important;
    font-size: 1.05rem !important;
    font-weight: 500 !important;
    color: var(--accent-primary) !important;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
  }

  .top-btn a:focus,
  .top-btn a:active {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
  }

  .top-btn a:hover {
    background: var(--accent-primary) !important;
    color: white !important;
    transform: none !important;
  }

  /* Background Overlay */
  .menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
  }

  .menu-backdrop.active {
    opacity: 1;
    visibility: visible;
  }

  /* Main Container */
  #main {
    margin: 1rem;
    padding: 1.5rem 1rem;
  }

  /* Table */
  table {
    border-spacing: 0 0.75rem !important;
  }

  th, td {
    display: block;
    width: 100%;
    border-radius: 6px;
    border: 1px solid var(--border-color);
  }

  th {
    border-radius: 6px 6px 0 0;
    border-bottom: none;
  }

  td {
    border-radius: 0 0 6px 6px;
  }

  .wd-s, .wd-m, .wd-l {
    max-width: 100%;
  }

  /* Form Submit */
  #form input[type="submit"] {
    margin-left: 0;
    margin-top: 0.75rem;
    width: 100%;
  }

  /* Search Form */
  #find {
    font-size: 0.95rem;
  }

  #find input[type="text"] {
    width: 100%;
    min-width: 100%;
    margin-right: 0;
    margin-bottom: 0.75rem;
  }

  #find select {
    width: 100%;
    min-width: 100%;
    margin: 0 0 0.75rem 0;
    display: block;
  }

  #find input[type="submit"] {
    width: 100%;
    margin-left: 0;
  }

  /* Search Results */
  .ta-c .art {
    font-size: 0.95rem;
  }

  .ta-c .art > b:not(:first-of-type) {
    margin-right: 0;
  }

  .ta-c .art > b:not(:first-of-type)::after {
    content: "\A";
    white-space: pre;
  }

  /* Post Info */
  .info {
    text-align: left !important;
    font-size: 0.9rem;
  }

  .info b {
    margin-right: 0;
  }

  .info b::after {
    content: "\A";
    white-space: pre;
  }

  .info span {
    margin-left: 0;
  }

  .info span::before {
    content: "\A記事";
    white-space: pre;
  }

  /* Delete Form */
  #del-form {
    font-size: 0.9rem;
  }

  #del-form form {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem 0.5rem;
    align-items: center;
  }

  #del-form input[type="tel"],
  #del-form input[type="password"] {
    width: 100%;
  }

  #del-form input[type="submit"] {
    grid-column: 1 / -1;
    width: 100%;
    margin: 0.5rem 0 0;
  }

  /* Note Page CLOSE Button Floating */
  .close {
    position: fixed !important;
    top: 15px !important;
    right: 15px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    text-align: right !important;
    z-index: 1100;
  }

  .close input[type="button"] {
    background: var(--accent-primary) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    box-shadow: var(--shadow-md) !important;
    cursor: pointer !important;
  }

  .close input[type="button"]:hover {
    background: var(--accent-secondary) !important;
  }

  /* Password and Captcha Input Margin */
  input[name="pwd"],
  input[name="captcha"] {
    margin-bottom: 0.6rem;
    display: block;
  }

  /* <td colspan="2"> th-like Style */
  td[colspan="2"] {
    background: var(--bg-secondary) !important;
    border-radius: 6px 6px 0 0 !important;
    border-bottom: none !important;
  }

  /* Normal td: No Top Border */
  td:not([colspan]) {
    border-top: none !important;
    border-radius: 0 0 6px 6px !important;
    margin-bottom: 0.75rem !important;
  }

  /* Next th After td: Top Radius + Margin */
  td:not([colspan]) + tr th {
    border-radius: 6px 6px 0 0 !important;
    margin-top: 0.75rem !important;
  }

  /* Comment or Last Row: Bottom Radius */
  td[colspan="2"]:has(textarea),
  tr:last-child td[colspan="2"] {
    border-bottom: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    margin-bottom: 0.75rem !important;
  }

  /* Comment Row Next td: Top Radius */
  td[colspan="2"]:has(textarea) + tr td {
    border-radius: 6px 6px 0 0 !important;
  }

  /* Image Display */
  .img-box {
    margin: 0.8rem 0;
    text-align: center;
  }

  .img-box a {
    display: inline-block;
    width: auto;
    max-width: 100%;
  }

  .img-box .thumbnail {
    max-height: 300px;
    width: auto;
    max-width: 100%;
    height: auto;
  }

  /* File Upload */
  input[type="file"] {
    font-size: 0.9rem;
    padding: 0.5rem 0.4rem;
    min-width: unset;
    width: 100%;
    max-width: none;
  }

  input[type="file"]::-webkit-file-upload-button,
  input[type="file"]::file-selector-button {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
  }

  td span[style*="font-size"] {
    font-size: 0.95rem !important;
    display: block;
    margin-top: 0.5rem;
  }
}

/* ========== Responsive - Small Mobile (max-width: 640px) ========== */
@media screen and (max-width: 640px) {
  html {
    font-size: 16px;
  }

  #head h1,
  #head b {
    font-size: 1.5rem;
  }

  .ttl {
    font-size: 1.1rem;
  }

  .info {
    text-align: left;
  }

  .button.small {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
  }

  /* Note Page: Show CLOSE Button */
  body .close {
    display: block;
  }

  /* Image Display */
  .img-box .thumbnail {
    max-height: 250px;
    width: auto;
    max-width: 100%;
  }
}
