:root {
  --primary-color: #1a73e8;
  --primary-hover: #1557b0;
  --danger-color: #ea4335;
  --bg-color: #f8f9fa;
  --surface-color: #ffffff;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --border-color: #dadce0;
  --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3),
    0 1px 3px 1px rgba(60, 64, 67, 0.15);
  --radius-md: 8px;
  --radius-lg: 16px;
}

body {
  font-family: "Google Sans", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
    sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  margin: 0;
  padding: 40px 20px;
  line-height: 1.6;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  background-color: var(--surface-color);
  padding: 48px;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
}

h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.2;
}

.app-description {
  text-align: center;
  margin-bottom: 60px;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.app-description > p {
  font-size: 1.125rem;
  max-width: 700px;
  margin: 0 auto 40px auto;
}

.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
  text-align: left;
}

.use-case-card {
  background: var(--bg-color);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s;
}

.use-case-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-color: var(--border-color);
}

.use-case-card h3 {
  font-size: 1.1rem;
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.use-case-card p {
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.5;
}

.footer {
  margin-top: auto;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
}

.status {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
}

.status.disconnected {
  background-color: #eee;
  color: #666;
}

.status.connected {
  background-color: #e6f4ea;
  color: #1e8e3e;
}

.status.error {
  background-color: #fce8e6;
  color: #d93025;
}

.auth-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  background: #f1f3f4;
  border-radius: 8px;
}

.description-box {
  width: 100%;
  margin-bottom: 20px;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 8px;
  text-align: left;
}

.description-box h3 {
  margin-top: 0;
}

.feature-list {
  margin: 10px 0 20px 20px;
}

.hidden {
  display: none !important;
}

.video-container {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
  position: relative;
}

#video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #333;
  color: #fff;
  font-size: 1.2rem;
  z-index: 1;
}

#video-placeholder.hidden {
  display: none;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
  min-height: 40px;
}

.btn:hover {
  opacity: 0.9;
}

.btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.btn.danger {
  background-color: var(--danger-color);
}

.chat-input {
  display: flex;
  gap: 0.5rem;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 1rem;
  max-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message {
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  max-width: 80%;
  word-wrap: break-word;
}

.message.user {
  align-self: flex-end;
  background-color: var(--primary-color);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.message.gemini {
  align-self: flex-start;
  background-color: #e9ecef;
  color: var(--text-primary);
  border-bottom-left-radius: 0.25rem;
}

input[type="text"] {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.note {
  font-size: 0.8rem;
  color: #666;
}

.session-end-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  background: #f8f9fa;
  border-radius: 8px;
  text-align: center;
  animation: fadeIn 0.5s ease-in-out;
}

.link-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.link-btn:hover {
  background-color: #e8f0fe;
}

.compact {
  font-size: 0.85rem;
  min-height: 34px;
  padding: 0.4rem 0.7rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Grid Layout for App Section */
.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.right-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
}

.left-panel,
.right-panel {
  background: #fff;
  border: 1px solid #eceff3;
  border-radius: 10px;
  padding: 0.9rem;
}

.input-area {
  display: flex;
  gap: 0.5rem;
}

.session-start-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  background: #f8fbff;
}

.permission-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.permission-dialog {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e4e8ef;
  padding: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
}

.permission-dialog h3 {
  margin: 0 0 8px 0;
  font-size: 1rem;
}

.permission-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 10px;
}

.permission-actions .btn {
  flex: 1;
}

#permissionStatus {
  margin-top: 10px;
  min-height: 1.1rem;
}

.chat-log {
  flex-grow: 1;
  max-height: 400px;
}

.mobile-nav {
  display: none;
  margin-bottom: 0.85rem;
  gap: 0.5rem;
  background: #f1f3f7;
  border: 1px solid #e0e5ed;
  border-radius: 10px;
  padding: 0.35rem;
}

.mobile-tab {
  flex: 1;
  min-height: 38px;
  background: transparent;
  color: #4b5563;
  font-size: 0.82rem;
  border-radius: 8px;
}

.mobile-tab.active {
  background: var(--primary-color);
  color: #fff;
}

.mobile-panel-hidden {
  display: none !important;
}

.progress-panel {
  margin-top: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: #fafbff;
}

.progress-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.progress-panel-header h3 {
  margin: 0;
  font-size: 1rem;
}

.progress-updated {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.progress-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.progress-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #e4e7eb;
  background: #fff;
}

.progress-item.wait {
  opacity: 0.8;
}

.progress-item.in_progress {
  border-color: #bcd3ff;
  background: #eef4ff;
}

.progress-item.done {
  border-color: #b9e6c3;
  background: #edf9f0;
}

.progress-step-text {
  font-size: 0.92rem;
}

.progress-status {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.progress-status.wait {
  color: #6b7280;
}

.progress-status.in_progress {
  color: #1d4ed8;
}

.progress-status.done {
  color: #1f7a3e;
}

@media (max-width: 768px) {
  body {
    padding: 8px;
    font-size: 14px;
  }

  .container {
    min-height: calc(100vh - 16px);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  }

  header {
    margin-bottom: 0.8rem;
    gap: 0.6rem;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  h1 {
    font-size: 1.15rem;
  }

  .status {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
  }

  .auth-section {
    padding: 0.9rem;
    gap: 0.7rem;
  }

  .description-box {
    margin-bottom: 10px;
    padding: 10px;
    font-size: 0.8rem;
  }

  .feature-list {
    margin: 6px 0 10px 16px;
    padding: 0;
  }

  .feature-list li {
    margin-bottom: 6px;
  }

  .app-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .session-start-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    margin-bottom: 0.7rem;
    padding: 0.55rem 0.6rem;
  }

  .session-start-row .btn {
    width: 100%;
    font-size: 0.82rem;
    min-height: 36px;
  }

  .session-start-row .note {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .permission-dialog {
    padding: 12px;
  }

  .permission-dialog h3 {
    font-size: 0.9rem;
  }

  .permission-actions {
    flex-direction: column;
    gap: 0.45rem;
  }

  .mobile-nav {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .left-panel,
  .right-panel {
    border-radius: 8px;
    padding: 0.6rem;
  }

  .video-container {
    margin-bottom: 0.6rem;
    border-radius: 6px;
  }

  #video-placeholder {
    font-size: 0.85rem;
  }

  .controls {
    margin-bottom: 0;
    gap: 0.45rem;
  }

  .controls .btn {
    flex: 1 1 calc(50% - 0.45rem);
    padding: 0.5rem 0.45rem;
    font-size: 0.78rem;
    min-height: 36px;
  }

  .chat-log {
    margin-bottom: 0.6rem;
    padding: 0.6rem;
    max-height: 45vh;
    gap: 0.4rem;
  }

  .message {
    max-width: 88%;
    font-size: 0.82rem;
    padding: 0.45rem 0.65rem;
  }

  input[type="text"] {
    font-size: 0.82rem;
    padding: 0.55rem 0.6rem;
  }

  .input-area .btn {
    font-size: 0.8rem;
    padding: 0.52rem 0.68rem;
    min-height: 36px;
  }

  .progress-panel {
    margin-top: 0.75rem;
    padding: 0.65rem;
  }

  .progress-panel-header {
    margin-bottom: 0.55rem;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
  }

  .progress-panel-header h3 {
    font-size: 0.9rem;
  }

  .progress-updated {
    font-size: 0.72rem;
  }

  .progress-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.55rem 0.6rem;
  }

  .progress-step-text {
    font-size: 0.8rem;
  }

  .progress-status {
    font-size: 0.68rem;
    letter-spacing: 0.03em;
  }
}
