:root {
  --color-primary: #0066cc;
  --color-primary-dark: #0052a3;
  --color-secondary: #00a0e9;
  --color-text: #222222;
  --color-text-sub: #555555;
  --color-accent: #ff9900;
  --color-border: #e0e0e0;
  --color-hover: #e0e0e0;
  --color-bg: #f7f9fC;
  --color-bg-sub: #ffffff;
  --color-bg-dark: #555555;
  --color-danger: #c0392b;
  --color-danger-hover: #a93226;

  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic", Meiryo, sans-serif;
  --font-base-size: 16px;
  --line-height-base: 1.7;

  --font-sm: 0.875rem;
  --font-md: 1rem;
  --font-lg: 1.25rem;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
}

html {
  font-size: var(--font-base-size);
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  background-color: var(--color-bg-dark);
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  width: 1200px;
  margin: 0 auto;
  padding: 0;

  display: grid;
  grid-template-areas:
    "header header"
    "nav-user nav-user"
    "nav-sidebar main"
    "jasrac main"
    "footer footer";
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto 1fr;

  color: var(--color-text);
  font-family: var(--font-base);
  font-size: 1rem;
  line-height: var(--line-height-base);

  background-color: var(--color-bg);

  overflow-x: hidden;
}

h1 {
  font-size: 24px;
  padding: 10px 15px;
}

h2 {
  font-size: 22px;
  padding: 5px 15px;
}

h3 {
  font-size: 18px;
  padding: 0 15px;
}

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

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

img {
  max-width: 100%;
  height: auto;
  vertical-align: bottom;
}

p {
  margin: 0 0 1em;
  text-indent: 0.5em;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #f0f0f0;
}

th,
td {
  padding: 10px 15px;
  border-bottom: 1px solid #ddd;
  font-size: 14px;
  text-align: left;
  overflow: hidden;
}

th {
  font-weight: 600;
}

td {
  vertical-align: middle;
}

input {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: #fff;
}

input[type="checkbox"] {
  scale: 1.5;
  width: 20px;
}

input[type="radio"] {
  scale: 1.2
}

select {
  width: calc(100% - 20px);
  padding: 8px 30px 8px 8px;
  margin: 10px;

  font-size: 14px;

  border: 1px solid #ccc;
  border-radius: 4px;

  background-color: #fff;
  cursor: pointer;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23666' d='M5 7l5 5 5-5z'/%3E%3C/svg%3E");

  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
}

select:hover {
  background-color: #f0f0f0;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23666' d='M5 7l5 5 5-5z'/%3E%3C/svg%3E");

  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
}

select:disabled,
input:disabled {
  cursor: default;
  background: #eee;
  color: #eee;
}

select:disabled:hover {
  background: #eee;
}

textarea {
  width: calc(100% - 20px);
  font-size: 0.8rem;
  padding: 0.4rem 0.5rem;
  margin: 10px;
  border: 1px solid #bbb;
  border-radius: 4px;
  line-height: 1.5;
  background-color: #fff;
  min-height: 140px;
  resize: vertical;

}

header {
  display: contents;
  background: #f0f0f0;
}

main {
  grid-area: main;
  width: 900px;
  margin-bottom: 30px;
  padding: 0 30px 48px;
}

.site-footer {
  grid-area: footer;
  text-align: center;
  background-color: var(--color-primary);
  padding: 10px 0 15px;
}

.footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.footer-nav a {
  color: #fff;
  text-decoration: none;
  padding: 0 10px;
}

.footer-nav a:hover {
  text-decoration: underline;
}


/* SNS / RSS */
.footer-sns {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 14px;
}

.footer-sns-link {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;
  padding: 0;
  color: #fff;
  text-decoration: none;

  transition: opacity 0.2s ease,
    transform 0.2s ease;
}

.x img {
  display: block;
  width: 15px;
  height: 15px;
}

.facebook img {
  display: block;
  width: 25px;
  height: 25px;
}

.youtube img {
  display: block;
  width: 32px;
  height: 32px;
}

.rss svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: #fff;
}

.footer-sns-link svg:hover,
.footer-sns-link img:hover {
  opacity: 0.7;
  color: initial;
}

.copyright {
  color: #fff;
  margin-top: 12px;
}

.error-massage {
  color: red;
  font-size: 0.8em;
  margin: 30px 10px;
}

.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 0.5rem 0;
}

.pagination a,
.pagination span {
  padding: 6px 10px;
  border: 1px solid #ccc;
  text-decoration: none;
}

.pagination .current {
  background: #333;
  color: #fff;
}

.site-header .logo {
  grid-area: header;
  margin: 0;
  padding: 10px 24px;
  background: var(--color-primary);
}

.site-header .logo img {
  width: 300px;
  height: 75px;
}

.site-header .site-name {
  font-size: 14px;
  color: white;
  font-weight: 200;
  margin-bottom: 5px;
}

#nav-user {
  grid-area: nav-user;
  display: flex;
  gap: 20px;
  padding: 10px 24px 5px;
  margin-left: auto;
  align-items: center;
  border-bottom: 1px solid #ddd;
}

#nav-user a {
  text-decoration: none;
  color: #333;
  font-size: 14px;
}

#nav-user a:hover {
  text-decoration: underline;
}

#nav-user svg {
  display: none;
}

#nav-sidebar {
  grid-area: nav-sidebar;
  width: 300px;
  background: #fafafa;
  border-right: 1px solid #ddd;
  overflow-y: auto;
}

.category-list {
  list-style: none;
  margin: 0;
  padding: 0 0 20px;
}

.category-item {
  margin: 0;
}

.category-item>a,
.category-toggle {
  display: block;
  width: 100%;
  padding: 6px 20px;
  font-size: 14px;
  color: #222;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}

.category-item>a {
  text-decoration: none;
}

.category-item>a:hover,
.category-toggle:hover {
  background: #eaeaea;
}

.category-toggle {
  position: relative;
  font-weight: 600;
}

.category-toggle::after {
  content: "▸";
  position: absolute;
  right: 20px;
  transition: transform 0.2s ease;
}

.category-item.open>.category-toggle::after {
  transform: rotate(90deg);
}

.category-item>.category-list {
  display: none;
}

.category-item.open>.category-list {
  display: block;
}

.category-item .category-list .category-item>a,
.category-item .category-list .category-toggle {
  padding-left: 40px;
  font-size: 13px;
  color: #444;
}

.category-item.open>a,
.category-item.open>.category-toggle {
  background: #e3e3e3;
}

.category-item .category-list .category-list a,
.category-item .category-list .category-list .category-toggle {
  padding-left: 60px;
  font-size: 12.5px;
  color: #555;
}

.lang-current {
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  font-size: 14px;
  color: #333;
}

.lang-current:hover {
  text-decoration: underline;
}

.lang-dropdown {
  position: relative;
  font-size: 14px;
}

.lang-menu {
  display: none;
  position: absolute;
  left: 0;
  background: #fff;
  border: 1px solid #ccc;
}

.lang-dropdown:hover .lang-menu {
  display: block;
}

.lang-menu form {
  margin: 0;
}

.lang-menu button {
  width: 100%;
  padding: 5px 10px;
  margin: 0;
  text-align: left;
  background: none;
  border: none;
  color: #333;
  cursor: pointer;
}

.lang-menu button:hover {
  background: var(--color-hover);
}

#license {
  grid-area: jasrac;
  width: 300px;
  height: 150px;
  background: #fafafa;
  overflow-y: auto;
  border-bottom: 1px solid #ddd;
  border-right: 1px solid #ddd;

  font-size: 14px;
  color: #222;
  word-break: break-all;
}

.jasrac {
  padding: 10px 30px;
  display: grid;
  border-top: 1px solid #ddd;
  grid-template-areas:
    "jasrac-icon jasrac-license"
    "jasrac-icon jasrac-number";

  align-items: center;
  justify-content: flex-start;
  gap: 0 10px;
}

.jasrac-icon {
  grid-area: jasrac-icon;
  width: 50px;
  height: 50px;
}

.jasrac-license {
  grid-area: jasrac-license;
  width: 100%;
  font-weight: 600;
}

.jasrac-number {
  grid-area: jasrac-number;
  width: 100%;
}

.nextone {
  padding: 10px 30px;
  display: grid;
  border-top: 1px solid #ddd;
  grid-template-areas:
    "nextone-icon nextone-license"
    "nextone-icon nextone-number";

  align-items: center;
  justify-content: flex-start;
  gap: 0 10px;
}

.nextone-icon {
  grid-area: nextone-icon;
  width: 50px;
  height: 50px;
}

.nextone-license {
  grid-area: nextone-license;
  width: 100%;
  font-weight: 600;
}

.nextone-number {
  grid-area: nextone-number;
  width: 100%;
}

.menu-toggle {
  display: none;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
  z-index: 900;
}

.menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

label.agree {
  cursor: pointer;
}


/* ===========================
   Mobile Layout
=========================== */

@media screen and (max-width: 768px) {

  body {
    width: 100%;
    margin: 0;
    grid-template-areas:
      "header"
      "nav-user"
      "main"
      "jasrac"
      "footer";
    grid-template-columns: 1fr;
    background-color: var(--color-bg);
  }

  .site-header .logo {
    padding: 10px 16px;
  }

  .site-header .logo img {
    width: 220px;
    height: auto;
  }

  #nav-user {
    padding: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: space-evenly;
  }

  #nav-user a,
  #nav-user .lang-dropdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 3px 10px;
    font-size: 13px;
    text-align: center;
    background: #fafafa;
  }

  #nav-user a:hover {
    background: #eaeaea;
    text-decoration: none;
  }

  #nav-user svg {
    display: block;
    width: 20px;
    height: 20px;
  }

  #nav-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: #fff;
    z-index: 1000;
    overflow-y: auto;
    transition: left 0.3s ease;
    border-right: 1px solid #ddd;
  }

  #nav-sidebar.open {
    left: 0;
  }

  .lang-menu button {
    font-size: 14px;
  }

  .lang-menu {
    top: 0;
  }

  main {
    width: 100%;
    padding: 0;
    margin: 0;
  }

  footer {
    padding: 5px 5px;
  }

  footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: space-evenly;
  }

  footer a {
    display: flex;
    margin: 0;
    font-size: 14px;
    padding: 0 10px;
  }

  .category-item>a,
  .category-toggle {
    padding: 10px 16px;
    font-size: 15px;
  }

  .category-item .category-list .category-item>a,
  .category-item .category-list .category-toggle {
    padding-left: 30px;
    font-size: 14px;
  }

  .category-item .category-list .category-list a,
  .category-item .category-list .category-list .category-toggle {
    padding-left: 45px;
  }

  #license {
    width: 100%;
    border-right: none;
  }

  .menu-toggle {
    display: block;
    position: fixed;
    width: 50px;
    height: 50px;
    right: 16px;
    top: 10px;
    font-size: 28px;
    background: var(--color-primary);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 8px;
    z-index: 999;
  }

  .pagination {
    display: flex;
    gap: 3px;
    justify-content: center;
    margin: 0.5rem 0;
    overflow: scroll;
  }

  .pagination a,
  .pagination span {
    padding: 6px 8px;
    border: 1px solid #ccc;
    text-decoration: none;
  }

  input[type="checkbox"] {
    scale: 2;
  }

  input[type="radio"] {
    scale: 1.5
  }
}