html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', 'Roboto', 'Hiragino Sans', 'Meiryo', sans-serif;
  color: #222;
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
  background-image: url('img/background.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

main,
.container {
  max-width: 500px;
  margin: 0 auto;
  min-height: 80vh;
  padding: 250px 0.5em 150px 0.5em;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  box-shadow: 0 2px 12px #0001;
}

h1,
h2,
h3 {
  font-weight: 700;
  margin: 1.2em 0 0.5em 0;
  color: #1848a0;
  letter-spacing: 0.02em;
}

h1 {
  font-size: 1.45rem;
  text-align: center;
  margin-top: 1em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="month"],
input[type="number"],
textarea,
select {
  width: 100%;
  font-size: 0.7rem;
  padding: 0.8em;
  border: 1px solid #d3d7e3;
  border-radius: 10px;
  background: #fafbfc;
  margin-bottom: 1em;
  transition: border 0.2s;
  box-sizing: border-box;
}

input:focus,
textarea:focus,
select:focus {
  border: 1.5px solid #a6bbe5;
  outline: none;
}

button,
input[type="submit"] {
  display: inline-block;
  font-size: 1rem;
  padding: 0.3em 0.8em;
  background: linear-gradient(90deg, rgb(28, 115, 222), rgb(28, 115, 222));
  color: rgb(255, 255, 255);
  border-radius: 100px;
  border-color: rgba(223, 209, 190, 0.884);
  margin: 0.5em 0;
  transition: background 0.18s, box-shadow 0.18s;
  cursor: pointer;
  letter-spacing: 0.03em;
}

button:active,
input[type="submit"]:active {
  background: #8aa2cd;
  box-shadow: none;
}

.notice,
.card,
.list-item {
  background: #f6f8fa;
  border-radius: 12px;
  margin: 1.2em 0;
  padding: 1.2em;
  box-shadow: 0 2px 6px #0001;
  transition: box-shadow 0.18s;
}

.notice:hover,
.card:hover,
.list-item:hover {
  box-shadow: 0 3px 16px #3079ed20;
}

.notice strong {
  color: #1848a0;
  font-size: 1.05rem;
}

label {
  font-weight: 500;
  margin-bottom: 0.3em;
  display: block;
  color: #204090;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: #3079ed;
  width: 1.15em;
  height: 1.15em;
  margin-right: 0.4em;
  vertical-align: middle;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0 1.7em 0;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px #0001;
}

th,
td {
  padding: 0.95em 0.6em;
  text-align: left;
  border-bottom: 1px solid #f0f2f7;
}

th {
  background: #f3f7fa;
  color: #1848a0;
  font-weight: 600;
  letter-spacing: 0.03em;
}

tr:last-child td {
  border-bottom: none;
}

canvas {
  max-width: 100%;
  margin: 1.2em 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 8px #0001;
}

@media (max-width: 599px) {

  main,
  .container {
    max-width: 100vw;
    padding: 0.5em 0.2em 1em 0.2em;
    border-radius: 0;
    box-shadow: none;
  }

  h1 {
    font-size: 1.1rem;
  }
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 60px;
  height: auto;
  padding-bottom: 5px;
  background: #fff;
  border-top: 1.5px solid #e7eaf3;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -1px 8px #0001;
  display: flex;
  z-index: 100;
  justify-content: space-around;
}

.nav-btn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: #204090;
  font-size: 0.93rem;
  padding-top: 7px;
  transition: background 0.17s;
}

.nav-btn:active,
.nav-btn.selected {
  background: #e8f0fd;
}

.nav-icon {
  font-size: 1.5rem;
  display: block;
  line-height: 1;
}

.nav-label {
  display: block;
  margin-top: 2px;
  font-size: 0.83rem;
  letter-spacing: 0.01em;
}

main,
.container {
  padding-bottom: 50px !important;
}

#previewArea img {
  width: 100%;
  max-height: 350px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 1em;
  box-shadow: 0 2px 12px #0001;
}

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  background: #ffffff;
  color: #222;
  padding: 0 1em;
  z-index: 110;
  box-sizing: border-box;
  border-bottom: 1px solid #e2e8f0;
}

main {
  padding-top: 54px;
  padding-left: 10px;
}

.app-title {
  font-size: 1.2rem;
  font-weight: bold;
}

.hamburger-btn {
  background: none;
  border: 2px solid #3498db;
  color: #000000;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  outline: none;
  margin-left: auto;
  margin-right: 0.1em;
  padding: 0.4em 0.8em;
  border-radius: 18px;
  transition: background-color 0.2s;
}

.dropdown-menu {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 54px;
  right: 0;
  text-align: left;
  background: #1C73DE;
  border-radius: 0 0 0.7em 0.7em;
  box-shadow: 0 4px 12px rgba(44, 62, 80, 0.13);
  min-width: 180px;
  overflow: hidden;
  border-top: 2px solid #63a4cf;
  z-index: 2000;
}

.dropdown-menu a {
  padding: 1em;
  text-decoration: none;
  color: white;
  border-bottom: 1px solid #eee;
  font-size: 1rem;
  transition: background 0.16s;
  text-align: left;
}

.dropdown-menu a:last-child {
  border-bottom: none;
}

.dropdown-menu a:hover {
  background: #ffffff;
  color: black;
}

@media (max-width: 600px) {
  .dropdown-menu {
    min-width: 120px;
    font-size: 0.96rem;
  }
}

.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  /* 背面を少し暗くして操作不可にする */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  /* 確実に最前面へ */
  pointer-events: auto;
  /* クリックを確実に受け取る */
}

.dialog-box {
  background-color: #fcf7f7;
  padding: 20px;
  border-radius: 28px;
  border-color: black;
  width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  text-align: center;
}


.dialog-message {
  margin-bottom: 20px;
  font-size: 1rem;
  white-space: pre-wrap;
}

.dialog-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.dialog-buttons button {
  padding: 6px 16px;
  border-color: black;
  cursor: pointer;
  border-radius: 24px;
  background: rgb(255, 255, 255);
  color: black;
  font-weight: bold;
}

button#confirmBtn {
  padding: 2px;
  border-radius: 6px;
  border: 1px solid #aaaaaa;
  background: #ffffff;
  cursor: pointer;
  color: #000000;
  transition: all 0.2s ease-in-out;
}

button#confirmBtn .icon {
  width: 50px;
  height: auto;
  vertical-align: middle;
}

.button-container {
  display: flex;
  justify-content: flex-end;
}

.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1em;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.input-password-mask {
  -webkit-text-security: disc;
}

@media screen and (max-width: 768px) {

  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  input[type="date"],
  input[type="datetime-local"],
  textarea,
  select {
    font-size: 1rem !important;
  }
}

body {
  font-size: 1rem;
}

h2 {
  font-size: 1.25rem;
}

.page-title-container {
  font-size: 1.1rem;
}

.font-size-control {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 15px;
  margin-bottom: 5px;
}

.fs-btn {
  -webkit-appearance: none;
  appearance: none;
  background-color: #f0f0f0 !important;
  color: #333 !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  font-size: 13px !important;
  padding: 4px 10px !important;
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
}

.fs-btn.active {
  background-color: #1e88e5 !important;
  color: #ffffff !important;
  border-color: #1e88e5 !important;
  font-weight: bold !important;
  box-shadow: 0 2px 4px rgba(30, 136, 229, 0.4) !important;
}

/* --- モード切り替えスイッチ --- */
.design-mode-toggle {
  display: flex;
  justify-content: center;
  padding: 12px;
  position: sticky;
  top: 54px;
  z-index: 101;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0;
}

.toggle-container {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  width: 280px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.toggle-option {
  flex: 1;
  text-align: center;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #64748b;
}

.toggle-option.active {
  background: #3b82f6 !important;
  color: white !important;
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2) !important;
}

/* --- モダンデザイン（.modern-design） --- */
.modern-design {
  background: #f8fafc !important;
  color: #1e293b !important;
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

.modern-design body {
  background-image: none !important;
  background: #f8fafc !important;
}

.modern-design main {
  background: transparent !important;
  box-shadow: none !important;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 120px 16px !important;
}

.modern-design .card,
.modern-design .image-slider-container {
  background: #ffffff !important;
  border-radius: 24px !important;
  border: 1px solid #f1f5f9 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05) !important;
  margin-bottom: 20px !important;
  padding: 20px !important;
}

.modern-design .alert-box {
  background: #ffebee !important;
  /* クラシックに合わせた赤っぽい背景色 */
  border-radius: 24px !important;
  border: 1px solid #ef5350 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05) !important;
  margin-bottom: 20px !important;
  padding: 20px !important;
}

.modern-design .section-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 32px 0 12px 12px;
}

.modern-design .admin-dashboard {
  background: #ffffff !important;
  border-radius: 32px !important;
  padding: 24px !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid #e2e8f0 !important;
}

.modern-design .admin-dashboard h3 {
  color: #0f172a !important;
  margin: 0 0 16px 0 !important;
  font-size: 1.1rem !important;
  font-weight: 800 !important;
  border: none !important;
}

.modern-design .admin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* 管理パネルの設定 */
.modern-design .admin-card-btn {
  background: #f8fafc !important;
  border: 1px solid #f1f5f9 !important;
  border-radius: 16px !important;
  padding: 12px 14px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  transition: all 0.2s !important;
  cursor: pointer !important;
  text-decoration: none !important;
  color: #475569 !important;
  margin: 0 !important;
  position: relative !important;
  overflow: visible !important;
  min-height: 30px !important;
  border-color: #b1c4e4 !important;
}

.modern-design .admin-card-btn:hover {
  background: #ffffff !important;
  transform: translateY(-2px) !important;
  border-color: #3b82f6 !important;
  color: #2563eb !important;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.15) !important;
}

.modern-design .admin-card-btn svg {
  width: 20px !important;
  height: 20px !important;
  color: #3b82f6;
  margin-bottom: 0 !important;
  flex-shrink: 0 !important;
}

.modern-design .admin-card-btn span {
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  text-align: left !important;
}

.modern-design .action-card {
  background: white;
  border-radius: 20px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #f1f5f9;
  transition: all 0.2s;
  position: relative;
  text-decoration: none;
  border-color: rgba(181, 179, 65, 0.4);
}

.modern-design .action-card:hover {
  border-color: #2563eb !important;
  background: rgb(252, 252, 252);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  transform: scale(1.05);
}

.modern-design .action-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: #3b82f6;
}

.modern-design .action-info h4 {
  margin: 0;
  font-size: 1rem;
  color: #1e293b;
  font-weight: 700;
}

.modern-design .action-info p {
  margin: 2px 0 0 0;
  font-size: 0.8rem;
  color: #64748b;
}

.modern-design .badge-pill {
  background: #ef4444;
  color: white;
  font-size: 0.75em;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  position: absolute;
  top: 6px;
  right: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1.5px solid white;
  animation: pulse 1.5s infinite;
}

.admin-dashboard,
.fileshareadmin-dashboard {
  background: #ffffff;
  border-radius: 24px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.admin-dashboard h3,
.fileshareadmin-dashboard h3 {
  margin: 0 0 20px 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1e293b;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.admin-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 20px;
  text-decoration: none;
  color: #475569;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: visible !important;
}

.admin-card-btn:hover {
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.1);
  transform: translateY(-3px);
  color: #3b82f6;
}

.admin-card-btn svg {
  margin-bottom: 10px;
  stroke: currentColor;
}

.admin-card-btn span {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

/* --- モダンモード時のスタイル --- */
body.modern-design .classic-only,
.modern-design #notice-menu-group,
.modern-design #poll-menu-group,
.modern-design #menu-group2 {
  display: none !important;
}

/* --- モダンモード専用要素の制御 --- */
.modern-only {
  display: none !important;
}

body.modern-design .modern-only {
  display: block !important;
}

/* action-gridの場合はGrid表示を確実に優先させる */
body.modern-design .action-grid.modern-only {
  display: grid !important;
}

/* 親コンテナ：2カラムのグリッド */
.modern-design .action-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 12px !important;
  width: 100% !important;
  margin-bottom: 20px !important;
  box-sizing: border-box !important;
}

/* 子要素（カード）：アクションカードのデザイン調整（横並び：左アイコン・右テキスト） */
.modern-design .action-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 12px 16px !important;
  background: #ffffff !important;
  /* お知らせ一覧　アンケート回答等の枠 */
  border: 1px solid #b7cbdf !important;
  border-radius: 20px !important;
  text-decoration: none !important;
  transition: all 0.2s !important;
  min-height: 35px !important;
  gap: 12px !important;
  position: relative !important;
}

.modern-design .action-card:hover {
  transform: translateY(-2px) !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.15) !important;
}

.modern-design .action-icon {
  width: 32px !important;
  height: 32px !important;
  flex-shrink: 0 !important;
  background: #eff6ff !important;
  color: #3b82f6 !important;
  border-radius: 12px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-bottom: 0 !important;
}

.modern-design .action-info {
  text-align: left !important;
  flex: 1 !important;
  min-width: 0 !important;
}

.modern-design .action-info h4 {
  margin: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.modern-design .action-info p {
  margin: 2px 0 0 0 !important;
  font-size: 0.7rem !important;
  color: #64748b !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* ドロップダウンメニューの修正 */
.modern-design .dropdown-menu {
  top: 54px !important;
  z-index: 9999 !important;
  border-radius: 0 0 16px 16px !important;
}

/* アイコンの間隔調整 */
.modern-design .action-card.half .action-icon {
  width: 40px !important;
  /* 少し小さめに調整 */
  height: 40px !important;
  flex-shrink: 0 !important;
  margin-right: 10px !important;
  margin-bottom: 0 !important;
  /* 縦並び時代のマージンを消す */
}

/* テキストエリアの調整 */
.modern-design .action-card.half .action-info {
  text-align: left !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
}

.modern-design .action-card.half .action-info h4 {
  font-size: 0.85rem !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

.modern-design .action-card.half .action-info p {
  font-size: 0.7rem !important;
  margin: 2px 0 0 0 !important;
  color: #64748b !important;
}