:root {
  --primary-color: #6a1b9a;
  /* Deep Purple */
  --secondary-color: #f06292;
  /* Soft Pink */
  --accent-color: #ffca28;
  /* Amber */
  --background-color: #f9f9f9;
  --text-color: #333;
  --white: #ffffff;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-600: #757575;
  --font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --radius: 8px;
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  font-weight: 600;
  color: var(--text-color);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--secondary-color);
}

/* Layout */
.container {
  width: 100%;
  max-width: 800px;
  /* Reduced from 1200px for better read width on standard screens, or keep 1200 */
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

/* Layout */
.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

/* Common form elements and others can start here if needed */

.menu-button:disabled {
  border-color: var(--gray-300);
  color: var(--gray-600);
  cursor: not-allowed;
}

/* Responsive Tables / Cards for Mobile */
.responsive-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.responsive-table th {
  background-color: var(--gray-100);
  color: var(--text-color);
  font-weight: 600;
  padding: 12px;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
}

.responsive-table td {
  padding: 12px;
  border-bottom: 1px solid var(--gray-200);
}

/* Mobile View for Tables - Card Style */
@media screen and (max-width: 768px) {

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td,
  .responsive-table th {
    display: block;
    width: 100%;
  }

  .responsive-table thead {
    display: none;
    /* Hide headers */
  }

  .responsive-table tr {
    margin-bottom: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 12px;
    border: 1px solid var(--gray-200);
  }

  .responsive-table td {
    border-bottom: none;
    padding: 6px 0;
    position: relative;
    text-align: right;
    /* Align value to right */
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .responsive-table td:before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--gray-600);
    text-align: left;
    margin-right: 12px;
  }

  /* Specific override for cells that shouldn't have labels or complex content */
  .responsive-table td.no-label:before {
    content: none;
  }

  .responsive-table td.full-width {
    display: block;
    text-align: left;
  }
}

/* Buttons */
button {
  cursor: pointer;
}

.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

/* Helpers */
.hidden {
  display: none;
}

/* Mobile-First Layout Core */
:root {
  --bottom-nav-height: 60px;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  /* Prevent body scroll, handle scroll in content area */
  background-color: var(--background-color, #f9f9f9);
  overscroll-behavior-y: none;
  /* スクロール時のバウンスを抑制 (PWA向け) */
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Top Menu (Desktop/Legacy) or Header */
.app-header {
  flex-shrink: 0;
}

/* Main Content Area */
.app-content {
  flex-grow: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Smooth scroll on iOS */
  padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
  /* セーフエリア対応 */
}

/* Mobile specific view */
@media (max-width: 768px) {
  .app-wrapper {
    /* Make room for bottom nav */
    height: 100%;
  }
}

/* Updated by Roo */
.member-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
  border: 1px solid #eee;
}

.member-name {
  font-size: 0.9em;
  font-weight: 600;
  line-height: 1.2;
}

.member-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Cast Modal */
.cast-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
}

.cast-modal-overlay.active {
  display: flex;
}

.cast-modal-content {
  background: #fff;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.cast-modal-header {
  border-bottom: 1px solid #ddd;
}

.cast-modal-body {
  padding: 20px;
  overflow-y: auto;
}

.cast-table {
  width: 100%;
  border-collapse: collapse;
}

.cast-table th,
.cast-table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
  font-size: 0.9rem;
}

.cast-table th {
  background-color: #f5f5f5;
}

/* Schedule Modal */
.schedule-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
}

.schedule-modal-overlay.active {
  display: flex;
}

.schedule-modal-content {
  background: #fff;
  width: 92%;
  max-width: 720px;
  max-height: 85vh;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.schedule-modal-header {
  border-bottom: 1px solid #eee;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}

.schedule-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  font-size: 0.9rem;
}

.schedule-modal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.85rem;
}

.schedule-modal-body table th,
.schedule-modal-body table td {
  border: 1px solid #e0e0e0;
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
}

.schedule-modal-body table thead th,
.schedule-modal-body table th {
  background-color: #f7f8fa;
  color: #333;
  font-weight: 600;
}

.schedule-modal-body table th.sat {
  color: #1976d2;
}

.schedule-modal-body table th.sun {
  color: #e53935;
}

.schedule-modal-body table th.wed {
  color: #00897b;
}

.schedule-modal-body table td.red {
  color: #d32f2f;
  background-color: #ffebee;
  font-weight: bold;
}

.schedule-modal-body table td.blue {
  color: #1565c0;
  background-color: #e3f2fd;
  font-weight: 500;
}