/* Base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
  padding: 1rem;
}

/* Container for content */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Typography */
h1 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2.5rem;
  margin-bottom: 1rem;
  text-align: center;
  color: #2c3e50;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
  color: #34495e;
}

h3 {
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
  color: #5d6d7e;
}

p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

/* Links */
a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* Navigation */
nav {
  background-color: #fff;
  padding: 1rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

nav li {
  margin: 0;
}

/* Hamburger menu styles */
.hamburger-toggle {
  display: none;
}

.hamburger-label {
  display: none;
  cursor: pointer;
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  z-index: 1000;
  padding: 0.5rem;
}

.hamburger-icon {
  display: block;
  width: 20px;
  height: 16px;
  position: relative;
}

.hamburger-icon span {
  display: block;
  position: absolute;
  height: 3px;
  width: 100%;
  background: #333;
  border-radius: 3px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: .25s ease-in-out;
}

.hamburger-icon span:nth-child(1) {
  top: 0px;
}

.hamburger-icon span:nth-child(2) {
  top: 6px;
}

.hamburger-icon span:nth-child(3) {
  top: 12px;
}

/* Hamburger animation */
.hamburger-toggle:checked + .hamburger-label .hamburger-icon span:nth-child(1) {
  top: 6px;
  transform: rotate(135deg);
}

.hamburger-toggle:checked + .hamburger-label .hamburger-icon span:nth-child(2) {
  opacity: 0;
  left: -60px;
}

.hamburger-toggle:checked + .hamburger-label .hamburger-icon span:nth-child(3) {
  top: 6px;
  transform: rotate(-135deg);
}

/* Cards and sections */
.card {
  background-color: #fff;
  padding: 1.5rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* App grid layout */
.app-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* 1/3ずつ均等幅 */
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.app-card {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-decoration: none;
}

.app-card .app-icon {
  width: 48px;
  height: 48px;
  margin-right: 1rem;
  flex-shrink: 0;
}

.app-card .app-info {
  flex: 1;
}

.app-card .app-info h3 {
  margin: 0 0 0.2rem 0;
  font-size: 1.1rem;
  color: #2c3e50;
}

.app-card .app-info p {
  margin: 0;
  font-size: 0.95rem;
  color: #444;
  line-height: 1.4;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
  text-align: center;
}

.btn:hover {
  background-color: #2980b9;
}

/* Keyboard shortcut styles */
.shortcut {
  background-color: #ecf0f1;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  margin: 0 0.2rem;
  display: inline-block;
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 1rem;
}

/* Responsive design for app grid */
@media (max-width: 1024px) {
  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* タブレット: 2列均等幅 */
  }
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
  body {
    padding: 0.5rem;
  }
  
  h1 {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
  }
  
  h2 {
    font-size: 1.4rem;
  }
  
  h3 {
    font-size: 1.2rem;
  }
  
  nav {
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    position: relative;
  }
  
  /* Show hamburger menu on mobile */
  .hamburger-label {
    display: block;
  }
  
  /* Hide navigation menu by default on mobile */
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 0.5rem 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    z-index: 999;
  }
  
  /* Show menu when hamburger is checked */
  .hamburger-toggle:checked ~ .nav-menu {
    display: flex;
  }
  
  .nav-menu li {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
  }
  
  .nav-menu li:last-child {
    border-bottom: none;
  }
  
  .nav-menu li a {
    display: block;
    padding: 0.75rem 1rem;
    background-color: transparent;
    border-radius: 0;
    width: 100%;
    transition: background-color 0.2s ease;
  }
  
  .nav-menu li a:hover {
    background-color: #f8f9fa;
  }
  
  .container {
    padding: 0 0.5rem;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  .card {
    padding: 1rem;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  main {
    padding: 0.5rem;
  }
  
  /* Mobile app grid layout */
  .app-grid {
    grid-template-columns: 1fr; /* モバイル: 1列 */
    gap: 1rem;
    width: 100%;
  }
  
  .app-card {
    width: 100%;
    padding: 0.75rem;
  }
  
  .app-card .app-icon {
    width: 40px;
    height: 40px;
    margin-right: 0.75rem;
  }
  
  .app-card .app-info h3 {
    font-size: 1rem;
  }
  
  .app-card .app-info p {
    font-size: 0.85rem;
  }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
  h1 {
    font-size: 2.2rem;
  }
  
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
  
  nav {
    padding: 0.75rem 1rem;
  }
  
  nav ul {
    gap: 0.75rem;
    justify-content: center;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  main {
    padding: 1rem;
  }
  
  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* タブレット: 2列均等幅 */
  }
}

/* Desktop styles */
@media (min-width: 1025px) {
  body {
    padding: 2rem;
  }
  
  .container {
    padding: 0 2rem;
  }
  
  nav ul {
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
  
  nav li {
    margin-right: 2rem;
  }
  
  nav li:last-child {
    margin-right: 0;
  }
}

/* Quiz styles */
.quiz-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.quiz-header {
  text-align: center;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 1rem;
}

.quiz-header h1 {
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.question-counter {
  font-size: 1.1rem;
  color: #6c757d;
  font-weight: 500;
}

.quiz-question h2 {
  margin-bottom: 1.5rem;
  color: #495057;
  text-align: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.quiz-options {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.quiz-option {
  padding: 1rem 1.5rem;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-option:hover:not(:disabled) {
  border-color: #007bff;
  background: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.15);
}

.quiz-option:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.quiz-option.correct {
  background: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.quiz-option.incorrect {
  background: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

.quiz-feedback {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
}

.feedback-message {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.feedback-message.correct {
  color: #28a745;
}

.feedback-message.incorrect {
  color: #dc3545;
}

.correct-answer {
  margin-top: 1rem;
  padding: 1rem;
  background: #e9ecef;
  border-radius: 6px;
  font-weight: 500;
}

.shortcut-details {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  text-align: left;
}

.shortcut-details h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.2rem;
  color: #333;
  font-weight: 600;
}

.shortcut-details p {
  margin: 0 0 1rem 0;
  color: #666;
  line-height: 1.6;
}

.memorize-hint {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #fff4e6;
  border-left: 4px solid #ffa500;
  border-radius: 4px;
  font-style: italic;
  color: #555;
}

.memorize-hint strong {
  color: #e67e00;
  font-weight: 700;
}

.next-button, .retry-button {
  background: #007bff;
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin: 0.5rem;
}

.next-button:hover, .retry-button:hover {
  background: #0056b3;
}

.quiz-result {
  text-align: center;
  padding: 2rem;
}

.quiz-result h2 {
  color: #28a745;
  margin-bottom: 1rem;
}

.score {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  font-weight: 600;
}

.score-comment {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: #e3f2fd;
  border-radius: 8px;
  color: #1976d2;
  line-height: 1.6;
  font-weight: 500;
  border: 1px solid #bbdefb;
}

.quiz-actions {
  margin-bottom: 1.5rem;
}

.quiz-navigation {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
  text-align: center;
}

.quiz-navigation a {
  display: inline-block;
  margin: 0.5rem;
  padding: 0.5rem 1rem;
  color: #007bff;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.quiz-navigation a:hover {
  background: #f8f9fa;
  text-decoration: underline;
}

/* Key styles for shortcuts */
.key {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  margin: 0 0.125rem;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: #495057;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Mobile responsiveness for quiz */
@media (max-width: 768px) {
  .quiz-detail {
    padding: 1rem;
    margin: 0.5rem;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .quiz-option {
    min-height: 50px;
    padding: 0.75rem 1rem;
  }

  .quiz-header h1 {
    font-size: 1.8rem;
  }

  .quiz-question h2 {
    font-size: 1.3rem;
    padding: 0.75rem;
  }
}

/* Category section styles */
.category-section {
  margin-bottom: 3rem;
}

.category-section:last-child {
  margin-bottom: 0;
}

.category-title {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  color: #2c3e50;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .category-section {
    margin-bottom: 2rem;
  }

  .category-title {
    font-size: 1.4rem;
    margin-bottom: 1rem;
  }
}