* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.5;
}

#app {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
}

.view {
  padding: 20px;
}

.hidden {
  display: none !important;
}

/* Header */
header {
  margin-bottom: 20px;
}

header h1 {
  margin: 0 0 5px 0;
  font-size: 1.5rem;
  color: #333;
}

.subtitle {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

/* Buttons */
button {
  font-size: 1rem;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  transition: background-color 0.2s;
}

.back-btn {
  background: none;
  color: #007aff;
  padding: 0;
  margin-bottom: 10px;
}

.primary-btn {
  background: #007aff;
  color: white;
  width: 100%;
  font-weight: 600;
}

.primary-btn:hover {
  background: #0056b3;
}

.primary-btn:disabled {
  background: #ccc;
}

.secondary-btn {
  background: none;
  color: #ff3b30;
  width: 100%;
  font-weight: 500;
  margin-top: 10px;
}

.secondary-btn:hover {
  background: rgba(255, 59, 48, 0.1);
}

#pattern-actions {
  margin-top: 20px;
}

.step-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-info {
  font-size: 0.8rem;
  color: #666;
  text-align: right;
  line-height: 1.3;
}

.nav-btn {
  background: #e0e0e0;
  color: #333;
  flex: 1;
}

.nav-btn:hover {
  background: #d0d0d0;
}

/* Pattern List */
#pattern-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pattern-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.pattern-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pattern-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 5px;
}

.pattern-card-header h2 {
  margin: 0;
  font-size: 1.1rem;
  flex: 1;
}

.pattern-card-header .skill-badge {
  flex-shrink: 0;
}

.pattern-card h2 {
  margin: 0 0 5px 0;
  font-size: 1.1rem;
}

.pattern-card p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Progress indicators on pattern cards */
.progress-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.progress-text {
  font-size: 0.85rem;
  color: #007aff;
}

.resume-btn {
  background: #007aff;
  color: white;
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 6px;
}

.resume-btn:hover {
  background: #0056b3;
}

/* Pattern Info */
#pattern-info {
  margin-bottom: 20px;
}

/* Pattern metadata badges */
.pattern-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 15px 0;
}

.skill-badge,
.technique-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.skill-badge {
  color: white;
}

.skill-beginner {
  background: #34c759;
}

.skill-easy {
  background: #5ac8fa;
}

.skill-intermediate {
  background: #ff9500;
}

.skill-advanced {
  background: #ff3b30;
}

.skill-expert {
  background: #af52de;
}

.technique-badge {
  background: #f0f0f0;
  color: #555;
  border: 1px solid #ddd;
}

#pattern-info h2 {
  font-size: 1rem;
  margin: 20px 0 10px 0;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#pattern-info p {
  margin: 0 0 10px 0;
}

#pattern-info ul {
  margin: 0;
  padding-left: 20px;
}

#pattern-info li {
  margin-bottom: 5px;
}

.abbrev-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 15px;
}

.abbrev-list dt {
  font-weight: 600;
}

.abbrev-list dd {
  margin: 0;
}

/* Size Selector */
#size-selector {
  margin-bottom: 20px;
}

#size-selector label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

#size-select {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

/* Progress Bar */
#progress-bar {
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

#progress-fill {
  height: 100%;
  background: #007aff;
  width: 0%;
  transition: width 0.3s ease;
}

/* Step View */
#step-container {
  text-align: center;
  padding: 40px 0;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#section-name {
  font-size: 0.85rem;
  color: #007aff;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

#step-counter {
  font-size: 0.9rem;
  color: #999;
  margin-bottom: 20px;
}

#step-content {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.4;
}

#step-content strong {
  color: #007aff;
  font-weight: 700;
}

#step-content em {
  font-style: italic;
  color: #666;
}

.repeat-indicator {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #999;
  font-weight: 400;
}

.step-divider {
  border: none;
  border-top: 1px solid #ddd;
  margin: 15px auto;
  width: 60%;
}

#step-nav {
  display: flex;
  gap: 12px;
}

/* Overview */
#overview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overview-section {
  margin-bottom: 20px;
}

.overview-section h2 {
  font-size: 1rem;
  color: #007aff;
  margin: 0 0 10px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.overview-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 8px;
  cursor: pointer;
}

.overview-item.completed {
  opacity: 0.6;
}

.overview-item .check {
  width: 24px;
  height: 24px;
  border: 2px solid #ddd;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overview-item.completed .check {
  background: #34c759;
  border-color: #34c759;
  color: white;
}

.overview-item .text {
  flex: 1;
  font-size: 0.95rem;
}

/* Complete message */
.complete-message {
  text-align: center;
  padding: 40px 20px;
}

.complete-message h2 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.complete-message p {
  color: #666;
}

/* Mobile optimizations */
@media (max-width: 500px) {
  #app {
    max-width: 100%;
  }

  .view {
    padding: 15px;
  }

  #step-content {
    font-size: 1.3rem;
  }
}
