/* Task-Based Learning Mode Styles */
#tbl-panel {
  display: none;
  height: 100vh;
  flex-direction: column;
  background-color: #f0f9ff;
  font-family: 'Lexend Deca', 'BIZ UDGothic', sans-serif;
  overflow-y: auto;
}

.tbl-header {
  background: linear-gradient(135deg, #E0F7FA 0%, #B2EBF2 100%);
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.tbl-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #006064;
}

.tbl-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Phase Navigation */
.tbl-phase-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  background: white;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.tbl-phase-step {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  color: #78909c;
  position: relative;
}

.tbl-phase-step.active {
  background-color: #e0f7fa;
  color: #0097a7;
}

.tbl-phase-step::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 6px solid #eceff1;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.tbl-phase-step:last-child::after {
  display: none;
}

/* Task Card */
.tbl-task-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  margin-bottom: 24px;
}

.tbl-task-title {
  font-size: 1.5rem;
  color: #263238;
  margin-bottom: 12px;
  border-bottom: 2px solid #e0f7fa;
  padding-bottom: 8px;
}

.tbl-task-desc {
  color: #546e7a;
  line-height: 1.6;
  font-size: 1.1rem;
}

/* Chat Interface (WebLLM) */
.tbl-chat-area {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 500px;
}

.tbl-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: #fafafa;
}

.tbl-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  position: relative;
  animation: fadeIn 0.3s ease;
}

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

.tbl-message.user {
  align-self: flex-end;
  background-color: #00bcd4;
  color: white;
  border-bottom-right-radius: 2px;
}

.tbl-message.ai {
  align-self: flex-start;
  background-color: white;
  border: 1px solid #e0e0e0;
  color: #37474f;
  border-bottom-left-radius: 2px;
}

.tbl-input-area {
  padding: 16px;
  background: white;
  border-top: 1px solid #eeeeee;
  display: flex;
  gap: 10px;
}

.tbl-input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.tbl-input:focus {
  border-color: #00bcd4;
}

.tbl-send-btn {
  background-color: #00bcd4;
  color: white;
  border: none;
  padding: 10px 25px;
  min-height: 48px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.tbl-send-btn:hover {
  background-color: #00acc1;
}

.tbl-send-btn:disabled {
  background-color: #cfd8dc;
  cursor: not-allowed;
}

/* Language Focus Section */
.tbl-focus-points {
  display: grid;
  gap: 16px;
}

.tbl-focus-item {
  background: white;
  padding: 16px;
  border-radius: 12px;
  border-left: 4px solid #00bcd4;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.tbl-focus-title {
  font-weight: 700;
  color: #00838f;
  margin-bottom: 8px;
  display: block;
}

/* Badge/Progress */
.tbl-badge-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.tbl-badge {
  background: linear-gradient(45deg, #ffd54f, #ffca28);
  color: #5d4037;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(255, 193, 7, 0.3);
}

/* Loading */
.tbl-loading {
  text-align: center;
  padding: 40px;
  color: #78909c;
}

.tbl-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0f7fa;
  border-top: 4px solid #00bcd4;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 1s linear infinite;
}

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

/* Tile Style Override */
/* 
   Chat Bubble Animation (Pattern 3) 
   AI Thinking State
*/
.chat-bubble {
    background-color: #e5e7eb;
    padding: 12px 20px;
    border-radius: 20px;
    border-bottom-left-radius: 4px; /* 吹き出しの尻尾風 */
    display: inline-flex;
    align-items: center;
}

.typing-indicator-bubble {
    display: flex;
    align-items: center;
    column-gap: 5px;
}

.typing-indicator-bubble span {
    width: 8px;
    height: 8px;
    background-color: #6b7280;
    border-radius: 50%;
    animation: bubble-wave 1.3s linear infinite;
}

.typing-indicator-bubble span:nth-child(2) { animation-delay: -1.1s; }
.typing-indicator-bubble span:nth-child(3) { animation-delay: -0.9s; }

@keyframes bubble-wave {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Hide default message styling when thinking to show only the bubble */
.tbl-message.thinking {
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.tbl-model-conversation {
    background: #fafafa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #00acc1;
    font-family: sans-serif;
}

.tbl-top-nav {
    max-width: 900px;
    margin: 20px auto 0;
    padding: 0 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .tbl-top-nav {
        padding: 0 10px;
        margin-top: 10px;
    }
    .tbl-container {
        padding: 10px 0; /* Remove horizontal padding of container */
    }
    .tbl-task-card {
        padding: 15px 10px;
        margin-bottom: 12px;
        border-radius: 0; /* Full width look */
        border-left: none;
        border-right: none;
    }
    .tbl-model-conversation {
        padding: 8px 4px;
        border-radius: 4px;
        border-left-width: 3px;
    }
}

/* PC display adjustment for tbl-content */
@media (min-width: 1024px) {
  #tbl-content,
  .tbl-top-nav {
    width: 60%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }
  
  #tbl-content .vocab-container,
  #tbl-content .tbl-task-card {
    width: 100%;
    max-width: none;
  }
}