/* =============================================
   ログトレFX - Global Styles
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

/* ----------- CSS Variables ----------- */
:root {
  --primary:        #1565C0;
  --primary-light:  #42A5F5;
  --primary-dark:   #0D47A1;
  --accent:         #FF8F00;
  --accent-light:   #FFB300;
  --bg:             #EEF4FB;
  --surface:        #FFFFFF;
  --surface-2:      #F0F4FF;
  --success:        #2E7D32;
  --success-light:  #E8F5E9;
  --error:          #C62828;
  --error-light:    #FFEBEE;
  --warning:        #E65100;
  --warning-light:  #FFF3E0;
  --text-primary:   #1A1A2E;
  --text-secondary: #546E7A;
  --text-hint:      #90A4AE;
  --border:         #BBDEFB;
  --shadow-sm:      0 2px 8px rgba(21, 101, 192, 0.12);
  --shadow-md:      0 4px 20px rgba(21, 101, 192, 0.16);
  --shadow-lg:      0 8px 40px rgba(21, 101, 192, 0.20);
  --radius-sm:      8px;
  --radius-md:      16px;
  --radius-lg:      24px;
  --radius-full:    9999px;
  --transition:     0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----------- Reset & Base ----------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ----------- Typography ----------- */
h1 { font-size: 2rem;   font-weight: 900; letter-spacing: -0.5px; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p  { font-size: 0.95rem; color: var(--text-secondary); }

/* ----------- Layout Helpers ----------- */
.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 20px;
}
.center { text-align: center; }
.flex   { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.mt-24  { margin-top: 24px; }
.mt-32  { margin-top: 32px; }

/* ----------- Material Icons ----------- */
.material-icons-round {
  font-family: 'Material Icons Round';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
  user-select: none;
}

/* ----------- Buttons ----------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-full);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  outline: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 16px rgba(21, 101, 192, 0.4);
}
.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(21, 101, 192, 0.5);
  text-decoration: none;
  color: #fff;
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 143, 0, 0.4);
}
.btn-accent:hover {
  box-shadow: 0 6px 24px rgba(255, 143, 0, 0.5);
  text-decoration: none;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text-primary);
}

.btn-lg { padding: 16px 40px; font-size: 1.05rem; }
.btn-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ----------- Cards ----------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-interactive:hover {
  transform: translateY(-4px);
  cursor: pointer;
}

/* ----------- Header / Navigation ----------- */
.site-header {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.site-logo:hover { text-decoration: none; opacity: 0.85; }
.logo-img {
  height: 36px;
  width: auto;
  display: block;
}

.site-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}
.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: .88rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all .2s;
}
.nav-link:hover { background: var(--surface-2); color: var(--primary); text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: .9rem;
}
.nav-user-btn:hover { background: var(--surface-2); }
.nav-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ----------- Badges ----------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: #E3F2FD; color: var(--primary); }
.badge-locked  { background: #ECEFF1; color: #90A4AE; }

/* ----------- Progress Bar ----------- */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: var(--radius-full);
  transition: width 0.5s var(--transition);
}

/* ----------- Form Elements ----------- */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(66, 165, 245, 0.2);
}

/* ----------- Chip / Tag ----------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ----------- Divider ----------- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ----------- Snackbar / Toast ----------- */
.snackbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text-primary);
  color: #fff;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transition: transform 0.3s var(--transition), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.snackbar.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ----------- Answer Choices ----------- */
.choice-btn {
  width: 100%;
  padding: 16px 20px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.5;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--primary-light);
  background: var(--surface-2);
  transform: translateX(4px);
}
.choice-btn .choice-label {
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
}
.choice-btn:hover:not(:disabled) .choice-label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.choice-btn.correct {
  border-color: var(--success);
  background: var(--success-light);
  cursor: default;
}
.choice-btn.correct .choice-label {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.choice-btn.wrong {
  border-color: var(--error);
  background: var(--error-light);
  cursor: default;
}
.choice-btn.wrong .choice-label {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}
.choice-btn.dimmed {
  opacity: 0.45;
  cursor: default;
}
.choice-btn:disabled { cursor: default; }

/* ----------- Level Colors ----------- */
.level-beginner  { --level-color: #1976D2; --level-bg: #E3F2FD; --level-icon: #42A5F5; }
.level-intermediate { --level-color: #6A1B9A; --level-bg: #F3E5F5; --level-icon: #AB47BC; }
.level-advanced  { --level-color: #BF360C; --level-bg: #FBE9E7; --level-icon: #FF7043; }

/* ----------- Mobile Nav Hamburger ----------- */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  order: -1; /* ロゴの左に配置しない：ユーザーボタンの隣 */
}
.nav-hamburger:hover { background: var(--surface-2); }

.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  z-index: 99;
  border-top: 1px solid var(--border);
  flex-direction: column;
  padding: 8px 0;
  animation: fadeNavDown 0.18s ease;
}
.mobile-nav-drawer.open { display: flex; }
@keyframes fadeNavDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mobile-nav-drawer .m-nav-link {
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
}
.mobile-nav-drawer .m-nav-link:hover {
  background: var(--surface-2);
  color: var(--primary);
  text-decoration: none;
}
.mobile-nav-drawer .m-nav-link.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: #EEF4FB;
}

/* ----------- Responsive ----------- */
@media (max-width: 640px) {
  .site-nav { display: none; }
  .nav-hamburger { display: flex; }
  .user-name { display: none; }
}

@media (max-width: 600px) {
  h1 { font-size: 1.6rem; }
  .container { padding: 0 16px; }
  .card { padding: 18px; }
  .btn-lg { padding: 14px 28px; }
  .snackbar { white-space: normal; max-width: calc(100vw - 32px); text-align: center; }
}

/* ----------- Page Fade-in Animation ----------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.4s ease both; }
.fade-in-2 { animation: fadeInUp 0.4s 0.1s ease both; }
.fade-in-3 { animation: fadeInUp 0.4s 0.2s ease both; }

/* ----------- Overlay / Modal ----------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 20, 50, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
  animation: fadeOverlay 0.2s ease;
}
@keyframes fadeOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* ----------- ウェルカムダイアログ ----------- */
.welcome-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px 32px;
  max-width: 520px;
  width: 92%;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
.welcome-logo {
  margin-bottom: 16px;
}
.welcome-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px;
}
.welcome-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0 0 24px;
}
.welcome-features {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}
.welcome-features li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.wf-icon {
  color: var(--primary);
  font-size: 28px !important;
  flex-shrink: 0;
  margin-top: 1px;
}
.welcome-features li strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.welcome-features li p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}
.welcome-start-btn {
  width: 100%;
  padding: 14px 0;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius);
  gap: 6px;
}
@media (max-width: 480px) {
  .welcome-dialog { padding: 28px 20px 24px; }
  .welcome-title  { font-size: 1.2rem; }
  .welcome-features li { padding: 11px 12px; }
  .wf-icon { font-size: 24px !important; }
}
